Add Kotlin language support#10
Merged
Merged
Conversation
daniel-munoz
force-pushed
the
kotlin
branch
4 times, most recently
from
July 25, 2026 21:37
f157137 to
1541eb2
Compare
2 tasks
daniel-munoz
force-pushed
the
kotlin
branch
3 times, most recently
from
July 26, 2026 05:57
36cb619 to
3d34bb8
Compare
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
Mirrors the Python provider's structure: sequential/parallel directory walking via internal/parallel, per-package glob helpers, and cyclomatic complexity calculation over verified tree-sitter-kotlin v1.1.0 node kinds. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
extractDeclarations only recursed into class_body, so functions declared directly in an enum class body (kind enum_class_body) were silently dropped. Fall back to enum_class_body when class_body is absent. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Implements config wiring for two new Kotlin-specific anti-pattern detectors: - detect_non_null_assertions: Flag !! non-null assertion usage - detect_run_blocking: Flag runBlocking usage outside fun main Follows the existing pattern for detect_magic_numbers and detect_duplicate_errors, adding defaults to constants.go, struct fields to AnalysisConfig, and merge logic to LoadConfig() and mergeAntiPatternSettings(). All detectors default to enabled. Includes TDD-driven test coverage validating defaults and merge behavior. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Adds YAML fixture entries for detect_non_null_assertions and detect_run_blocking to the TestLoadConfig_ValidConfigFile test, exercising the mapstructure tags and viper unmarshaling round-trip behavior. Also extends the TestMerge "merge Phase 2.2 anti-pattern overrides" test case to validate merge logic for both new Kotlin detector flags, ensuring consistency with existing anti-pattern detector tests (detect_magic_numbers, detect_duplicate_errors). This completes the round-trip test coverage pattern established by the codebase, covering defaults, viper unmarshaling, and merge behavior for the new options. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Mirrors the Python tree-sitter detector runner structure: re-parses the file, locates each function's body by name/start line, and runs the generic detectors (too many parameters, deep nesting, too many returns, magic numbers) plus Kotlin-specific detectors for non-null assertions (!!) and runBlocking (excluding fun main, where it's the legitimate coroutine bridge idiom). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The previous guard (fn.Name != "main") exempted any function named
main from run_blocking detection, including class methods that are
not JVM entry points (e.g. class Runner { fun main() { runBlocking {} } }).
Now only a top-level fun main (ReceiverType == "") is exempt.
Also documents two accepted detector limitations: else-if chains count
toward nesting depth (inherent to the AST), and fully-qualified
kotlinx.coroutines.runBlocking calls are not matched by the
plain-identifier check.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Implements language.Language interface for Kotlin code analysis: - Provider mirrors Python provider pattern exactly - Registers parser and detector runner - Adds Kotlin-specific exclude patterns (build/, .gradle/, test sources) - Coverage and dependency analysis stubbed for future phases - Registers Kotlin in orchestrator with alphabetical ordering All 15 Kotlin tests pass (12 existing + 3 new provider tests). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Extend language.DetectLanguage to recognize Kotlin projects by scanning for Gradle manifest files (build.gradle.kts, settings.gradle.kts, build.gradle, settings.gradle). Kotlin detection is prioritized after existing languages (Go, Python, JavaScript) to preserve existing manifest precedence. - Added blank import of kotlin language provider to registry_test.go - Added four new test cases for Kotlin detection (Gradle Kotlin DSL and Groovy) - Added priority test to ensure Go takes precedence over Kotlin - Extended manifestChecks slice in registry.go to include Gradle files - Updated error message to list Kotlin as a supported language - Updated doc comment to list all supported manifest types Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Fix gofmt formatting: change double space to single space before comments - Add subtest for settings.gradle.kts priority among Gradle manifest variants - Verifies multiple Gradle manifests coexisting resolve cleanly Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Add Kotlin to language options in analyze command (--language flag and Long description) - Add Kotlin example to analyze command usage - Add Kotlin to init command default config template - Add detect_non_null_assertions and detect_run_blocking options to all configs - Update README with Kotlin in supported languages table - Add Kotlin to auto-detection manifest list (build.gradle, build.gradle.kts) - Add Kotlin examples to Quick Start section - Add comprehensive Kotlin language-specific features section - Update configuration reference blocks with Kotlin-specific detectors - Update CLI reference language flag documentation - Add Gradle projects troubleshooting section - Update project structure tree with kotlin directories - Add Kotlin provider to architecture components Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
internal/language/kotlin/provider, following the established tree-sitter pattern (grammar:tree-sitter-grammars/tree-sitter-kotlinv1.1.0)whenbranches,&&/||, and the elvis operator)const val/UPPER_CASE exemption) plus two Kotlin-specific detectors:!!non-null assertions andrunBlockingusage (exempting only top-levelfun main), both config-gated viadetect_non_null_assertions/detect_run_blockingsettings.gradle.kts,build.gradle.kts,settings.gradle,build.gradle); detection caveats (Java-only Gradle repos,package.jsonprecedence) documented in README troubleshootingDesign spec and implementation plan are included under
docs/superpowers/.Test Plan
go test -short ./...— full suite green (19 packages)go run . analyze testdata/kotlin --language kotlin --verbose— 3 files, 17 functions, expected issues found (incl.!!, runBlocking outside main, magic numbers with UPPER_CASE exemption)build.gradle.ktsfixture project without--language--compareround-trip works🤖 Generated with Claude Code