SonarKotlin: Better Sstatic Code Analysis Tool for Kotlin
summary
SonarKotlin replaces the old Slang engine with Kotlin PSI plus semantic binding contexts, increasing rule coverage from ~40 to 98 rules and adding security and regex checks; the analyzer grows into a 33 MB plugin and initially causes steep slowdowns because it naively generates binding contexts per file, causing O(n×classpath) work. The bottleneck is fixed by generating the binding context generated once per module, and an expensive heuristic for commented-out code is removed (commented-out-code rule disabled), restoring usable performance.
AI-written summary · about
chapters (17)
- 0:00Introduction and speaker intro
- 3:20Disclaimers and presentation goals
- 6:29Agenda and project history
- 9:40Slang engine overview and limitations
- 13:11Trade-offs of using Slang for Kotlin
- 14:55Decision to create SonarKotlin 2.0
- 18:51Choosing Kotlin PSI over alternatives
- 23:27Challenges with Kotlin PSI
- 28:44Why semantic analysis is needed
- 33:00Paying technical debt in SonarKotlin
- 36:31Plugin size optimization struggles
- 39:22Performance issues after 2.0 release
- 44:14Debugging performance with user feedback
- 47:46Fixing binding context performance
- 49:11Achievements in SonarKotlin 2.9
- 49:31Key takeaways from the project
- 50:33Acknowledgments and closing
