Skip to content

Commit 91fbff1

Browse files
runningcodeclaude
andauthored
build(detekt): Lint all Kotlin modules (#6178)
* build(detekt): Apply Compose guide and lint all Kotlin modules Add the remaining settings from detekt's Compose guide. Keep accepting SCREAMING_CASE top-level constants, because the guide's PascalCase-only pattern would flag every existing TRACE_ORIGIN-style constant. sentry-compose had the detekt plugin applied but the task was always NO-SOURCE, because the default source set is src/main and a multiplatform module keeps its code in src/androidMain. Point it at the Android source sets. Also enable detekt in sentry-android-replay, where it was commented out, and in the Kotlin modules that never applied it. The newly linted modules have 298 existing findings. Record them in per-module baselines so check passes and only new issues fail. They can be fixed in follow-ups. Refs JAVA-748 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * build(detekt): Move Compose guide settings to a separate PR Regenerate the baselines against main's config so this PR doesn't depend on the config change. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent 0f0be1c commit 91fbff1

17 files changed

Lines changed: 322 additions & 2 deletions

File tree

‎build.gradle.kts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ subprojects {
117117
buildUponDefaultConfig = true
118118
allRules = true
119119
config.setFrom("${rootProject.rootDir}/detekt.yml")
120+
baseline = file("detekt-baseline.xml")
120121
}
121122
}
122123

‎sentry-android-distribution/build.gradle.kts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
44
plugins {
55
id("com.android.library")
66
alias(libs.plugins.kotlin.android)
7+
alias(libs.plugins.detekt)
78
}
89

910
android {
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<SmellBaseline>
3+
<ManuallySuppressedIssues/>
4+
<CurrentIssues>
5+
<ID>MagicNumber:DistributionHttpClient.kt$DistributionHttpClient$200</ID>
6+
<ID>MagicNumber:DistributionHttpClient.kt$DistributionHttpClient$299</ID>
7+
<ID>MagicNumber:DistributionHttpClient.kt$DistributionHttpClient.HttpResponse$200</ID>
8+
<ID>MagicNumber:DistributionHttpClient.kt$DistributionHttpClient.HttpResponse$299</ID>
9+
<ID>MagicNumber:UpdateResponseParser.kt$UpdateResponseParser$200</ID>
10+
<ID>MagicNumber:UpdateResponseParser.kt$UpdateResponseParser$400</ID>
11+
<ID>MagicNumber:UpdateResponseParser.kt$UpdateResponseParser$499</ID>
12+
<ID>MagicNumber:UpdateResponseParser.kt$UpdateResponseParser$500</ID>
13+
<ID>MagicNumber:UpdateResponseParser.kt$UpdateResponseParser$599</ID>
14+
<ID>MaxLineLength:DistributionHttpClient.kt$DistributionHttpClient$"/api/0/projects/${URLEncoder.encode(orgSlug, "UTF-8")}/${URLEncoder.encode(projectSlug, "UTF-8")}/preprodartifacts/check-for-updates/"</ID>
15+
<ID>SwallowedException:DistributionIntegration.kt$DistributionIntegration$e: android.content.ActivityNotFoundException</ID>
16+
<ID>TooGenericExceptionCaught:DistributionIntegration.kt$DistributionIntegration$e: Exception</ID>
17+
<ID>TooGenericExceptionCaught:UpdateResponseParser.kt$UpdateResponseParser$e: Exception</ID>
18+
<ID>UseCheckOrError:DistributionHttpClient.kt$DistributionHttpClient$throw IllegalStateException( "Missing required distribution configuration: orgSlug, projectSlug, or orgAuthToken" )</ID>
19+
<ID>UseCheckOrError:DistributionHttpClient.kt$DistributionHttpClient$throw IllegalStateException("sentryClientName must be set")</ID>
20+
<ID>UseCheckOrError:DistributionIntegration.kt$DistributionIntegration$throw IllegalStateException("buildConfiguration must be set in distribution options")</ID>
21+
<ID>UseRequire:UpdateResponseParser.kt$UpdateResponseParser$throw IllegalArgumentException( "Missing required fields in API response: ${missingFields.joinToString(", ")}" )</ID>
22+
<ID>WildcardImport:DistributionHttpClientTest.kt$import org.junit.Assert.*</ID>
23+
</CurrentIssues>
24+
</SmellBaseline>

‎sentry-android-replay/build.gradle.kts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ plugins {
88
alias(libs.plugins.kotlin.android)
99
alias(libs.plugins.kotlin.compose)
1010
alias(libs.plugins.gradle.versions)
11-
// TODO: enable it later
12-
// alias(libs.plugins.detekt)
11+
alias(libs.plugins.detekt)
1312
}
1413

1514
android {

‎sentry-android-replay/detekt-baseline.xml‎

Lines changed: 165 additions & 0 deletions
Large diffs are not rendered by default.

‎sentry-apollo-3/build.gradle.kts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ plugins {
55
`java-library`
66
id("io.sentry.javadoc")
77
alias(libs.plugins.kotlin.jvm)
8+
alias(libs.plugins.detekt)
89
alias(libs.plugins.errorprone)
910
alias(libs.plugins.gradle.versions)
1011
alias(libs.plugins.buildconfig)
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<SmellBaseline>
3+
<ManuallySuppressedIssues/>
4+
<CurrentIssues>
5+
<ID>ClassNaming:LaunchDetailsQuery_ResponseAdapter.kt$LaunchDetailsQuery_ResponseAdapter</ID>
6+
<ID>ClassNaming:LaunchDetailsQuery_VariablesAdapter.kt$LaunchDetailsQuery_VariablesAdapter : Adapter</ID>
7+
<ID>CyclomaticComplexMethod:SentryApollo3HttpInterceptor.kt$SentryApollo3HttpInterceptor$private fun captureEvent( request: HttpRequest, response: HttpResponse, operationName: String?, operationType: String?, )</ID>
8+
<ID>LongMethod:SentryApollo3HttpInterceptor.kt$SentryApollo3HttpInterceptor$private fun captureEvent( request: HttpRequest, response: HttpResponse, operationName: String?, operationType: String?, )</ID>
9+
<ID>LongParameterList:SentryApollo3HttpInterceptor.kt$SentryApollo3HttpInterceptor$( span: ISpan?, request: HttpRequest, response: HttpResponse?, statusCode: Int?, operationName: String?, operationType: String?, operationId: String?, )</ID>
10+
<ID>LongParameterList:SentryApollo3InterceptorClientErrors.kt$SentryApollo3InterceptorClientErrors.Fixture$( captureFailedRequests: Boolean = DEFAULT_CAPTURE_FAILED_REQUESTS, failedRequestTargets: List&lt;String> = listOf(DEFAULT_PROPAGATION_TARGETS), httpStatusCode: Int = 200, responseBody: String = responseBodyOk, sendDefaultPii: Boolean = false, includeCookies: Boolean = sendDefaultPii, socketPolicy: SocketPolicy = SocketPolicy.KEEP_OPEN, configureOptions: SentryOptions.() -> Unit = {}, )</ID>
11+
<ID>MaxLineLength:LaunchDetailsQuery.kt$LaunchDetailsQuery.Companion$"query LaunchDetails(${'$'}id: ID!) { launch(id: ${'$'}id) { id site mission { name missionPatch(size: LARGE) } rocket { name type } } }"</ID>
12+
<ID>MaxLineLength:SentryApollo3InterceptorTest.kt$SentryApollo3InterceptorTest$"thirdPartyBaggage=someValue,secondThirdPartyBaggage=secondValue; property;propertyKey=propertyValue,anotherThirdPartyBaggage=anotherValue"</ID>
13+
<ID>MaxLineLength:SentryApollo3InterceptorTest.kt$SentryApollo3InterceptorTest.Fixture$"secondThirdPartyBaggage=secondValue; property;propertyKey=propertyValue,anotherThirdPartyBaggage=anotherValue"</ID>
14+
<ID>NestedBlockDepth:SentryApollo3HttpInterceptor.kt$SentryApollo3HttpInterceptor$private fun captureEvent( request: HttpRequest, response: HttpResponse, operationName: String?, operationType: String?, )</ID>
15+
<ID>NestedBlockDepth:SentryApollo3HttpInterceptor.kt$SentryApollo3HttpInterceptor$private fun finish( span: ISpan?, request: HttpRequest, response: HttpResponse?, statusCode: Int?, operationName: String?, operationType: String?, operationId: String?, )</ID>
16+
<ID>NestedBlockDepth:SentryApollo3HttpInterceptor.kt$SentryApollo3HttpInterceptor$private fun maybeAddTracingHeaders( scopes: IScopes, request: HttpRequest, span: ISpan?, ): HttpRequest</ID>
17+
<ID>ReturnCount:SentryApollo3HttpInterceptor.kt$SentryApollo3HttpInterceptor$private fun captureEvent( request: HttpRequest, response: HttpResponse, operationName: String?, operationType: String?, )</ID>
18+
<ID>SwallowedException:SentryApollo3InterceptorClientErrors.kt$SentryApollo3InterceptorClientErrors$e: ApolloException</ID>
19+
<ID>SwallowedException:SentryApollo3InterceptorTest.kt$SentryApollo3InterceptorTest$e: ApolloException</ID>
20+
<ID>SwallowedException:SentryApollo3InterceptorWithVariablesTest.kt$SentryApollo3InterceptorWithVariablesTest$e: ApolloException</ID>
21+
<ID>TooGenericExceptionCaught:SentryApollo3HttpInterceptor.kt$SentryApollo3HttpInterceptor$e: Throwable</ID>
22+
<ID>TooGenericExceptionThrown:SentryApollo3InterceptorTest.kt$SentryApollo3InterceptorTest$throw RuntimeException()</ID>
23+
<ID>TooManyFunctions:SentryApollo3HttpInterceptor.kt$SentryApollo3HttpInterceptor : HttpInterceptor</ID>
24+
<ID>UseCheckOrError:LaunchDetailsQuery_VariablesAdapter.kt$LaunchDetailsQuery_VariablesAdapter$throw IllegalStateException("Input type used in output position")</ID>
25+
<ID>UtilityClassWithPublicConstructor:GraphQLBoolean.kt$GraphQLBoolean</ID>
26+
<ID>UtilityClassWithPublicConstructor:GraphQLID.kt$GraphQLID</ID>
27+
<ID>UtilityClassWithPublicConstructor:GraphQLString.kt$GraphQLString</ID>
28+
<ID>UtilityClassWithPublicConstructor:Launch.kt$Launch</ID>
29+
<ID>UtilityClassWithPublicConstructor:Mission.kt$Mission</ID>
30+
<ID>UtilityClassWithPublicConstructor:Query.kt$Query</ID>
31+
<ID>UtilityClassWithPublicConstructor:Rocket.kt$Rocket</ID>
32+
</CurrentIssues>
33+
</SmellBaseline>

‎sentry-apollo-4/build.gradle.kts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ plugins {
55
`java-library`
66
id("io.sentry.javadoc")
77
alias(libs.plugins.kotlin.jvm)
8+
alias(libs.plugins.detekt)
89
alias(libs.plugins.errorprone)
910
alias(libs.plugins.gradle.versions)
1011
alias(libs.plugins.buildconfig)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<SmellBaseline>
3+
<ManuallySuppressedIssues/>
4+
<CurrentIssues>
5+
<ID>ClassNaming:LaunchDetailsQuery_ResponseAdapter.kt$LaunchDetailsQuery_ResponseAdapter</ID>
6+
<ID>ClassNaming:LaunchDetailsQuery_VariablesAdapter.kt$LaunchDetailsQuery_VariablesAdapter : Adapter</ID>
7+
<ID>CyclomaticComplexMethod:SentryApollo4HttpInterceptor.kt$SentryApollo4HttpInterceptor$private fun captureEvent( request: HttpRequest, response: HttpResponse, operationName: String?, operationType: String?, )</ID>
8+
<ID>LongMethod:SentryApollo4HttpInterceptor.kt$SentryApollo4HttpInterceptor$private fun captureEvent( request: HttpRequest, response: HttpResponse, operationName: String?, operationType: String?, )</ID>
9+
<ID>LongParameterList:SentryApollo4BuilderExtensionsClientErrorsTest.kt$SentryApollo4BuilderExtensionsClientErrorsTest.Fixture$( captureFailedRequests: Boolean = DEFAULT_CAPTURE_FAILED_REQUESTS, failedRequestTargets: List&lt;String> = listOf(DEFAULT_PROPAGATION_TARGETS), httpStatusCode: Int = 200, responseBody: String = responseBodyOk, sendDefaultPii: Boolean = false, includeCookies: Boolean = sendDefaultPii, socketPolicy: SocketPolicy = SocketPolicy.KEEP_OPEN, configureOptions: SentryOptions.() -> Unit = {}, )</ID>
10+
<ID>LongParameterList:SentryApollo4HttpInterceptor.kt$SentryApollo4HttpInterceptor$( span: ISpan?, request: HttpRequest, response: HttpResponse?, statusCode: Int?, operationName: String?, operationType: String?, operationId: String?, )</ID>
11+
<ID>MaxLineLength:LaunchDetailsQuery.kt$LaunchDetailsQuery.Companion$"query LaunchDetails(${'$'}id: ID!) { launch(id: ${'$'}id) { id site mission { name missionPatch(size: LARGE) } rocket { name type } } }"</ID>
12+
<ID>MaxLineLength:LaunchDetailsQuerySelections.kt$LaunchDetailsQuerySelections$CompiledArgument.Builder(CompiledArgumentDefinition.Builder("size").build()).value("LARGE").build()</ID>
13+
<ID>MaxLineLength:SentryApollo4HttpInterceptorTest.kt$SentryApollo4HttpInterceptorTest$"thirdPartyBaggage=someValue,secondThirdPartyBaggage=secondValue; property;propertyKey=propertyValue,anotherThirdPartyBaggage=anotherValue"</ID>
14+
<ID>MaxLineLength:SentryApollo4HttpInterceptorTest.kt$SentryApollo4HttpInterceptorTest.Fixture$"secondThirdPartyBaggage=secondValue; property;propertyKey=propertyValue,anotherThirdPartyBaggage=anotherValue"</ID>
15+
<ID>NestedBlockDepth:SentryApollo4HttpInterceptor.kt$SentryApollo4HttpInterceptor$private fun captureEvent( request: HttpRequest, response: HttpResponse, operationName: String?, operationType: String?, )</ID>
16+
<ID>NestedBlockDepth:SentryApollo4HttpInterceptor.kt$SentryApollo4HttpInterceptor$private fun finish( span: ISpan?, request: HttpRequest, response: HttpResponse?, statusCode: Int?, operationName: String?, operationType: String?, operationId: String?, )</ID>
17+
<ID>NestedBlockDepth:SentryApollo4HttpInterceptor.kt$SentryApollo4HttpInterceptor$private fun maybeAddTracingHeaders( scopes: IScopes, request: HttpRequest, span: ISpan?, ): HttpRequest</ID>
18+
<ID>ReturnCount:SentryApollo4HttpInterceptor.kt$SentryApollo4HttpInterceptor$private fun captureEvent( request: HttpRequest, response: HttpResponse, operationName: String?, operationType: String?, )</ID>
19+
<ID>SwallowedException:SentryApollo4BuilderExtensionsClientErrorsTest.kt$SentryApollo4BuilderExtensionsClientErrorsTest$e: ApolloException</ID>
20+
<ID>SwallowedException:SentryApollo4BuilderExtensionsTest.kt$SentryApollo4BuilderExtensionsTest$e: ApolloException</ID>
21+
<ID>SwallowedException:SentryApollo4HttpInterceptorTest.kt$SentryApollo4HttpInterceptorTest$e: ApolloException</ID>
22+
<ID>TooGenericExceptionCaught:SentryApollo4HttpInterceptor.kt$SentryApollo4HttpInterceptor$e: Throwable</ID>
23+
<ID>TooGenericExceptionThrown:SentryApollo4HttpInterceptorTest.kt$SentryApollo4HttpInterceptorTest$throw RuntimeException()</ID>
24+
<ID>TooManyFunctions:SentryApollo4HttpInterceptor.kt$SentryApollo4HttpInterceptor : HttpInterceptor</ID>
25+
<ID>UseCheckOrError:LaunchDetailsQuery_VariablesAdapter.kt$LaunchDetailsQuery_VariablesAdapter$throw IllegalStateException("Input type used in output position")</ID>
26+
<ID>UtilityClassWithPublicConstructor:GraphQLBoolean.kt$GraphQLBoolean</ID>
27+
<ID>UtilityClassWithPublicConstructor:GraphQLID.kt$GraphQLID</ID>
28+
<ID>UtilityClassWithPublicConstructor:GraphQLString.kt$GraphQLString</ID>
29+
<ID>UtilityClassWithPublicConstructor:Launch.kt$Launch</ID>
30+
<ID>UtilityClassWithPublicConstructor:Mission.kt$Mission</ID>
31+
<ID>UtilityClassWithPublicConstructor:Query.kt$Query</ID>
32+
<ID>UtilityClassWithPublicConstructor:Rocket.kt$Rocket</ID>
33+
</CurrentIssues>
34+
</SmellBaseline>

‎sentry-apollo/build.gradle.kts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ plugins {
55
`java-library`
66
id("io.sentry.javadoc")
77
alias(libs.plugins.kotlin.jvm)
8+
alias(libs.plugins.detekt)
89
alias(libs.plugins.errorprone)
910
alias(libs.plugins.gradle.versions)
1011
alias(libs.plugins.buildconfig)

0 commit comments

Comments
 (0)