chore(detekt): scan flavor, iosMain and jvmAndroidMain sources - #6836
Conversation
detekt's source list only named the main/common source sets, so src/fdroid, src/google (75 files in androidApp and core:barcode), src/iosMain (29 files), and src/jvmAndroidMain (14 files) were never analyzed despite the zero-lint gate. List every production source set that ships code; test source sets stay unscanned, matching the original list's policy. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The subset of the 139 surfaced violations that can be fixed without behavior change: - MagicNumber: extracted named constants across the fdroid and google map/AI files, reusing canonical values where they exist (Marker.ANCHOR_CENTER, GeoConstants.DEG_D/HEADING_DEG). - ParameterNaming: lambda parameters to present tense (onPositionSelect, onMappableCountChange, onManageCustomTileProvidersClick), kept identical across the flavor pairs, all named-argument call sites updated. - FunctionOnlyReturningConstant: suppressed with rationale — these are flavor-dispatch functions whose counterpart returns a different constant, so the function-ness is load-bearing. - UnusedParameter in MeshtasticAppFunctions: suppressed at class level — the androidx AppFunctions calling convention requires the AppFunctionContext parameter. - EmptyFunctionBlock/MaxLineLength: no-op comment and line wrap. Structural findings (LongMethod, complexity, ViewModelForwarding, TooGenericExceptionCaught, ThrowsCount, ...) are left to the per-module baseline, per the existing incremental-cleanup convention. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (34)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe pull request updates Detekt source coverage and baselines, replaces map literals with named constants, renames map callback parameters, and documents flavor-specific and iOS no-op implementations. ChangesStatic analysis and map maintenance
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to The change expands production-source lint coverage, applies mechanical cleanup, and records existing structural findings in module baselines without reported behavior changes; no actionable merge-blocking risk remains after normal checks and review. 🚥 Pre-merge checks | ✅ 8✅ Passed checks (8 passed)
Warning Some tools did not complete. Review the errors below. 🔧 PMD (7.26.0)androidApp/src/main/kotlin/org/meshtastic/app/MainActivity.ktPicked up JAVA_TOOL_OPTIONS: -XX:+PerfDisableSharedMem androidApp/src/fdroid/kotlin/org/meshtastic/app/map/FdroidMapOverlayRenderer.ktPicked up JAVA_TOOL_OPTIONS: -XX:+PerfDisableSharedMem androidApp/src/google/kotlin/org/meshtastic/app/map/GetMapViewProvider.ktPicked up JAVA_TOOL_OPTIONS: -XX:+PerfDisableSharedMem ... [truncated 1316 characters] ... .internal.loader.URLClassPath.getResource(URLClassPath.java:320)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Regenerated per-module baselines for the violations left after the mechanical pass — androidApp's flavor code (58 structural findings: LongMethod, complexity, ViewModelForwarding, TooGenericExceptionCaught, ...) plus core:ui and feature:settings iosMain entries. The ParameterNaming findings on iosMain actual functions stay baselined deliberately: renaming an actual's parameters desyncs the commonMain expect declaration, and renaming both sides is a public-API refactor. Fixed the ones that needed no such trade-off: - EmptyFunctionBlock in TestUtils.ios.kt and NoopStubs.kt no-op stubs - MagicNumber in TAKServerJvm (SERVER_SOCKET_BACKLOG) core:testing's baseline held only the now-fixed entry, so it is gone again. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
96789e5 to
634141b
Compare
detekt's source list in the convention plugin only named
src/main,src/commonMain,src/androidMain, andsrc/jvmMain— so despite the zero-lint gate, four production source sets were never analyzed at all:src/fdroid+src/googlesrc/iosMainsrc/jvmAndroidMainTurning them on surfaced ~150 accumulated violations. This PR fixes the mechanical ones and baselines the structural rest, per the existing per-module-baseline convention (
Detekt.kt's own comment: remove baselines incrementally as modules are cleaned up). Test source sets remain unscanned, matching the original list's policy.(Found while working on #6834 — an adversarial review of that branch noticed its new fdroid-flavor code was never being linted.)
🧹 Chores
Detekt.kt: list every production source set that ships code, with a comment explaining why explicitness matters here.MagicNumber(~45): named constants across both flavors' map/AI code andcore:takserver, reusing canonical values where they exist (Marker.ANCHOR_CENTER,GeoConstants.DEG_D/HEADING_DEG).ParameterNaming(3 renames):onPositionSelect,onMappableCountChange,onManageCustomTileProvidersClick— kept identical across the fdroid/google flavor pairs, all named-argument call sites updated (incl.MainActivity).FunctionOnlyReturningConstant(4): suppressed with rationale — flavor-dispatch functions whose counterpart returns a different constant, so the function-ness is load-bearing.UnusedParameterinMeshtasticAppFunctions: class-level suppress — the androidx AppFunctions calling convention requires theAppFunctionContextparameter.EmptyFunctionBlock(3) in iOS no-op stubs, oneMaxLineLengthwrap.LongMethod, complexity,ViewModelForwarding,TooGenericExceptionCaught,ThrowsCount, …) plus small counts incore:ui,core:takserver,feature:settings. TheParameterNaminghits on iosMainactualfunctions stay baselined deliberately: renaming anactual's parameters desyncs the commonMainexpectdeclaration, and renaming both sides is a public-API refactor.core:testing's baseline held exactly one now-fixed entry, so it's deleted.Testing Performed
./gradlew spotlessApply spotlessCheck detekt assembleDebug test allTests kmpSmokeCompile— fully green (kmpSmokeCompileincluded because iosMain files changed and must still compile for the iOS targets).🤖 Generated with Claude Code
Summary by CodeRabbit
Refactor
Chores