|
| 1 | +# Detekt configuration for JetBrains Toolbox Plugin Auto-Approval Compliance |
| 2 | +# Based on clarified requirements from JetBrains team |
| 3 | + |
| 4 | +build: |
| 5 | + maxIssues: 1000 # Allow many issues for code quality reporting |
| 6 | + excludeCorrectable: false |
| 7 | + |
| 8 | +config: |
| 9 | + validation: true |
| 10 | + warningsAsErrors: false # Don't treat warnings as errors |
| 11 | + checkExhaustiveness: false |
| 12 | + |
| 13 | +# CRITICAL: JetBrains Compliance Rules using detekt built-in rules |
| 14 | +style: |
| 15 | + active: true |
| 16 | + |
| 17 | + # JetBrains Auto-Approval Compliance: Forbidden experimental annotations |
| 18 | + ForbiddenAnnotation: |
| 19 | + active: true |
| 20 | + annotations: |
| 21 | + - reason: 'Forbidden for JetBrains auto-approval: Core Kotlin experimental APIs are not allowed' |
| 22 | + value: 'kotlin.ExperimentalStdlibApi' |
| 23 | + - reason: 'Forbidden for JetBrains auto-approval: Core Kotlin experimental APIs are not allowed' |
| 24 | + value: 'kotlin.ExperimentalUnsignedTypes' |
| 25 | + - reason: 'Forbidden for JetBrains auto-approval: Core Kotlin experimental APIs are not allowed' |
| 26 | + value: 'kotlin.contracts.ExperimentalContracts' |
| 27 | + - reason: 'Forbidden for JetBrains auto-approval: Core Kotlin experimental APIs are not allowed' |
| 28 | + value: 'kotlin.experimental.ExperimentalTypeInference' |
| 29 | + - reason: 'Forbidden for JetBrains auto-approval: Internal coroutines APIs should be avoided' |
| 30 | + value: 'kotlinx.coroutines.InternalCoroutinesApi' |
| 31 | + - reason: 'Forbidden for JetBrains auto-approval: Experimental time APIs are not allowed' |
| 32 | + value: 'kotlin.time.ExperimentalTime' |
| 33 | + # Note: ExperimentalCoroutinesApi, DelicateCoroutinesApi, FlowPreview are acceptable |
| 34 | + # based on JetBrains feedback about select/onTimeout being OK |
| 35 | + |
| 36 | + # JetBrains Auto-Approval Compliance: Forbidden method calls |
| 37 | + ForbiddenMethodCall: |
| 38 | + active: true |
| 39 | + methods: |
| 40 | + # Java runtime hooks - forbidden |
| 41 | + - reason: 'Forbidden for JetBrains auto-approval: Java runtime hooks are not allowed' |
| 42 | + value: 'java.lang.Runtime.addShutdownHook' |
| 43 | + - reason: 'Forbidden for JetBrains auto-approval: Java runtime hooks are not allowed' |
| 44 | + value: 'java.lang.System.setSecurityManager' |
| 45 | + - reason: 'Forbidden for JetBrains auto-approval: Java runtime hooks are not allowed' |
| 46 | + value: 'java.lang.Thread.setUncaughtExceptionHandler' |
| 47 | + - reason: 'Forbidden for JetBrains auto-approval: Java runtime hooks are not allowed' |
| 48 | + value: 'java.lang.Thread.setDefaultUncaughtExceptionHandler' |
| 49 | + # Manual thread creation - warnings (allowed with proper cleanup) |
| 50 | + - reason: 'Warning for JetBrains auto-approval: Manual thread creation detected. Consider using coroutineScope.launch or ensure proper cleanup in CoderRemoteProvider#close()' |
| 51 | + value: 'java.lang.Thread.<init>' |
| 52 | + - reason: 'Warning for JetBrains auto-approval: Manual thread creation detected. Consider using coroutineScope.launch or ensure proper cleanup in CoderRemoteProvider#close()' |
| 53 | + value: 'java.util.concurrent.Executors.newFixedThreadPool' |
| 54 | + - reason: 'Warning for JetBrains auto-approval: Manual thread creation detected. Consider using coroutineScope.launch or ensure proper cleanup in CoderRemoteProvider#close()' |
| 55 | + value: 'java.util.concurrent.Executors.newCachedThreadPool' |
| 56 | + - reason: 'Warning for JetBrains auto-approval: Manual thread creation detected. Consider using coroutineScope.launch or ensure proper cleanup in CoderRemoteProvider#close()' |
| 57 | + value: 'java.util.concurrent.Executors.newSingleThreadExecutor' |
| 58 | + - reason: 'Warning for JetBrains auto-approval: Manual thread creation detected. Consider using coroutineScope.launch or ensure proper cleanup in CoderRemoteProvider#close()' |
| 59 | + value: 'java.util.concurrent.CompletableFuture.runAsync' |
| 60 | + - reason: 'Warning for JetBrains auto-approval: Manual thread creation detected. Consider using coroutineScope.launch or ensure proper cleanup in CoderRemoteProvider#close()' |
| 61 | + value: 'java.util.concurrent.CompletableFuture.supplyAsync' |
| 62 | + |
| 63 | + # JetBrains Auto-Approval Compliance: Forbidden imports |
| 64 | + ForbiddenImport: |
| 65 | + active: true |
| 66 | + imports: |
| 67 | + # Potentially bundled libraries - warnings |
| 68 | + - reason: 'Warning for JetBrains auto-approval: Ensure slf4j is not bundled - it is provided by Toolbox' |
| 69 | + value: 'org.slf4j.*' |
| 70 | + - reason: 'Warning for JetBrains auto-approval: Ensure annotations library is not bundled - it is provided by Toolbox' |
| 71 | + value: 'org.jetbrains.annotations.*' |
| 72 | + # Runtime hook classes - forbidden |
| 73 | + - reason: 'Forbidden for JetBrains auto-approval: Runtime hook classes are not allowed' |
| 74 | + value: 'java.lang.Runtime' |
| 75 | + - reason: 'Forbidden for JetBrains auto-approval: Security manager modifications are not allowed' |
| 76 | + value: 'java.security.SecurityManager' |
| 77 | + |
| 78 | + # Other important style rules |
| 79 | + MagicNumber: |
| 80 | + active: true |
| 81 | + ignoreNumbers: |
| 82 | + - '-1' |
| 83 | + - '0' |
| 84 | + - '1' |
| 85 | + - '2' |
| 86 | + ignoreHashCodeFunction: true |
| 87 | + ignorePropertyDeclaration: false |
| 88 | + ignoreLocalVariableDeclaration: false |
| 89 | + ignoreConstantDeclaration: true |
| 90 | + ignoreCompanionObjectPropertyDeclaration: true |
| 91 | + ignoreAnnotation: false |
| 92 | + ignoreNamedArgument: true |
| 93 | + ignoreEnums: false |
| 94 | + ignoreRanges: false |
| 95 | + ignoreExtensionFunctions: true |
| 96 | + |
| 97 | + MaxLineLength: |
| 98 | + active: true |
| 99 | + maxLineLength: 120 |
| 100 | + excludePackageStatements: true |
| 101 | + excludeImportStatements: true |
| 102 | + excludeCommentStatements: false |
| 103 | + |
| 104 | + NewLineAtEndOfFile: |
| 105 | + active: true |
| 106 | + |
| 107 | + WildcardImport: |
| 108 | + active: true |
| 109 | + |
| 110 | +# Essential built-in rules for basic code quality |
| 111 | +complexity: |
| 112 | + active: true |
| 113 | + CyclomaticComplexMethod: |
| 114 | + active: true |
| 115 | + threshold: 15 |
| 116 | + LongMethod: |
| 117 | + active: true |
| 118 | + threshold: 60 |
| 119 | + LongParameterList: |
| 120 | + active: true |
| 121 | + functionThreshold: 6 |
| 122 | + constructorThreshold: 7 |
| 123 | + NestedBlockDepth: |
| 124 | + active: true |
| 125 | + threshold: 4 |
| 126 | + |
| 127 | +coroutines: |
| 128 | + active: true |
| 129 | + GlobalCoroutineUsage: |
| 130 | + active: true |
| 131 | + RedundantSuspendModifier: |
| 132 | + active: true |
| 133 | + SleepInsteadOfDelay: |
| 134 | + active: true |
| 135 | + |
| 136 | +exceptions: |
| 137 | + active: true |
| 138 | + ExceptionRaisedInUnexpectedLocation: |
| 139 | + active: true |
| 140 | + ObjectExtendsThrowable: |
| 141 | + active: true |
| 142 | + PrintStackTrace: |
| 143 | + active: true |
| 144 | + ReturnFromFinally: |
| 145 | + active: true |
| 146 | + SwallowedException: |
| 147 | + active: true |
| 148 | + ThrowingExceptionFromFinally: |
| 149 | + active: true |
| 150 | + ThrowingExceptionsWithoutMessageOrCause: |
| 151 | + active: true |
| 152 | + TooGenericExceptionCaught: |
| 153 | + active: true |
| 154 | + TooGenericExceptionThrown: |
| 155 | + active: true |
| 156 | + |
| 157 | +naming: |
| 158 | + active: true |
| 159 | + ClassNaming: |
| 160 | + active: true |
| 161 | + classPattern: '[A-Z][a-zA-Z0-9]*' |
| 162 | + FunctionNaming: |
| 163 | + active: true |
| 164 | + functionPattern: '[a-z][a-zA-Z0-9]*' |
| 165 | + PackageNaming: |
| 166 | + active: true |
| 167 | + packagePattern: '[a-z]+(\.?[a-z][A-Za-z0-9]*)*' |
| 168 | + VariableNaming: |
| 169 | + active: true |
| 170 | + variablePattern: '[a-z][A-Za-z0-9]*' |
| 171 | + |
| 172 | +performance: |
| 173 | + active: true |
| 174 | + ArrayPrimitive: |
| 175 | + active: true |
| 176 | + ForEachOnRange: |
| 177 | + active: true |
| 178 | + SpreadOperator: |
| 179 | + active: true |
| 180 | + UnnecessaryTemporaryInstantiation: |
| 181 | + active: true |
| 182 | + |
| 183 | +potential-bugs: |
| 184 | + active: true |
| 185 | + EqualsAlwaysReturnsTrueOrFalse: |
| 186 | + active: true |
| 187 | + EqualsWithHashCodeExist: |
| 188 | + active: true |
| 189 | + ExplicitGarbageCollectionCall: |
| 190 | + active: true |
| 191 | + HasPlatformType: |
| 192 | + active: true |
| 193 | + InvalidRange: |
| 194 | + active: true |
| 195 | + UnreachableCatchBlock: |
| 196 | + active: true |
| 197 | + UnreachableCode: |
| 198 | + active: true |
| 199 | + UnsafeCallOnNullableType: |
| 200 | + active: true |
| 201 | + UnsafeCast: |
| 202 | + active: true |
| 203 | + WrongEqualsTypeParameter: |
| 204 | + active: true |
0 commit comments