Skip to content

fix: tune Java/Kotlin patterns to reduce false positives#22

Merged
avifenesh merged 1 commit intomainfrom
fix/java-kotlin-false-positive-tuning
Feb 25, 2026
Merged

fix: tune Java/Kotlin patterns to reduce false positives#22
avifenesh merged 1 commit intomainfrom
fix/java-kotlin-false-positive-tuning

Conversation

@avifenesh
Copy link
Contributor

Summary

Tested the new Java/Kotlin patterns against 6 real-world repos (1955 files):

Repo Type Files
spring-petclinic Java corporate 47
spring-authorization-server Java corporate 468
nowinandroid Kotlin mobile 351
Pokedex Kotlin mobile 66
gson Java lib 261
Exposed Kotlin lib 762

Patterns tuned

  • java_suppress_warnings: Narrowed to unchecked|rawtypes|all|deprecation only (was matching serial, ThreadLocalUsage, PMD.*)
  • kotlin_suppress_annotation: Narrowed to UNCHECKED_CAST|DEPRECATION|unused only (was matching MagicNumber, ForbiddenComment, UnstableApiUsage)
  • java_raw_type: Added \b word boundary (was false-positive on JWKSet, ResultSet, SourceSet, BitSet)
  • kotlin_println_debugging: Excluded *.gradle.kts, *.gradle, **/snippets/** (Gradle println is standard output, not debugging)

Results

Total false positives reduced: 544 -> 286 matches (-47%). All remaining matches are true positives.

Test plan

  • 1506 tests passing
  • New negative tests for all narrowed patterns
  • Re-scanned all 6 repos after tuning

Tested against 6 real-world repos (1955 files total):
- spring-petclinic, spring-authorization-server (Java corporate)
- nowinandroid, Pokedex (Kotlin mobile)
- gson (Java lib), Exposed (Kotlin lib)

Changes:
- java_suppress_warnings: narrow to unchecked|rawtypes|all|deprecation
  (was matching serial, ThreadLocalUsage, PMD.* etc.)
- kotlin_suppress_annotation: narrow to UNCHECKED_CAST|DEPRECATION|unused
  (was matching MagicNumber, ForbiddenComment, UnstableApiUsage etc.)
- java_raw_type: add \b word boundary to prevent matching JWKSet,
  ResultSet, SourceSet, BitSet as raw types
- kotlin_println_debugging: exclude *.gradle.kts, *.gradle, snippets/
  (println in Gradle scripts is standard, not debug output)

False positive reduction: 544 -> 286 matches (-47%) across test repos.
All remaining matches are true positives.
@avifenesh avifenesh merged commit e5902a3 into main Feb 25, 2026
3 checks passed
@avifenesh avifenesh deleted the fix/java-kotlin-false-positive-tuning branch February 25, 2026 23:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant