Documentation
¶
Overview ¶
Package kotlin provides Kotlin language support for code analysis.
Package kotlin provides Kotlin language support for code analysis.
This package implements the language.Language interface for Kotlin, using tree-sitter for parsing and custom detectors for anti-pattern detection.
Index ¶
- type KotlinDetectorRunner
- type KotlinLanguage
- func (k *KotlinLanguage) CoverageRunner(cfg *config.AnalysisConfig, statusReporter status.Reporter) language.CoverageRunner
- func (k *KotlinLanguage) DefaultExcludePatterns() []string
- func (k *KotlinLanguage) DependencyAnalyzer(projectPath string) (language.DependencyAnalyzer, error)
- func (k *KotlinLanguage) DetectorRunner(cfg *config.AnalysisConfig) language.DetectorRunner
- func (k *KotlinLanguage) DisplayName() string
- func (k *KotlinLanguage) Extensions() []string
- func (k *KotlinLanguage) Name() string
- func (k *KotlinLanguage) Parser(workers int) parser.Parser
- type KotlinParser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KotlinDetectorRunner ¶
type KotlinDetectorRunner struct {
// contains filtered or unexported fields
}
KotlinDetectorRunner implements language.DetectorRunner for Kotlin source code.
func NewDetectorRunner ¶
func NewDetectorRunner(cfg *config.AnalysisConfig) *KotlinDetectorRunner
NewDetectorRunner creates a new detector runner for Kotlin source code.
func (*KotlinDetectorRunner) RunDetectors ¶
func (r *KotlinDetectorRunner) RunDetectors(cfg *config.AnalysisConfig, file *parser.FileMetrics) []*detectors.Issue
RunDetectors parses a Kotlin file and runs all enabled detectors.
type KotlinLanguage ¶
type KotlinLanguage struct{}
KotlinLanguage implements language.Language for Kotlin source code.
func (*KotlinLanguage) CoverageRunner ¶
func (k *KotlinLanguage) CoverageRunner(cfg *config.AnalysisConfig, statusReporter status.Reporter) language.CoverageRunner
CoverageRunner returns nil as Kotlin coverage is not yet implemented. Kotlin coverage support will be added in a future phase using Kover/JaCoCo reports.
func (*KotlinLanguage) DefaultExcludePatterns ¶
func (k *KotlinLanguage) DefaultExcludePatterns() []string
DefaultExcludePatterns returns Kotlin/Gradle-specific exclude patterns.
func (*KotlinLanguage) DependencyAnalyzer ¶
func (k *KotlinLanguage) DependencyAnalyzer(projectPath string) (language.DependencyAnalyzer, error)
DependencyAnalyzer returns nil as Kotlin dependency analysis is not yet implemented. Kotlin dependency analysis will be added in a future phase using Gradle manifests.
func (*KotlinLanguage) DetectorRunner ¶
func (k *KotlinLanguage) DetectorRunner(cfg *config.AnalysisConfig) language.DetectorRunner
DetectorRunner returns a Kotlin-specific detector runner.
func (*KotlinLanguage) DisplayName ¶
func (k *KotlinLanguage) DisplayName() string
DisplayName returns "Kotlin".
func (*KotlinLanguage) Extensions ¶
func (k *KotlinLanguage) Extensions() []string
Extensions returns [".kt"]. .kts files (Gradle build scripts) are deliberately excluded: they are build configuration, not production code, and would pollute codebase metrics.
type KotlinParser ¶
type KotlinParser struct {
// contains filtered or unexported fields
}
KotlinParser implements parser.Parser for Kotlin source files using tree-sitter.
func NewParser ¶
func NewParser(workers int) *KotlinParser
NewParser creates a new Kotlin parser. The workers parameter controls parallel parsing (0=auto, 1=sequential).
func (*KotlinParser) ParseDirectory ¶
func (p *KotlinParser) ParseDirectory(rootPath string, excludePatterns []string, extensions []string, statusReporter status.Reporter) ([]*parser.FileMetrics, []error)
ParseDirectory recursively parses all Kotlin files in a directory. If Workers is set to 1, parsing is sequential. Otherwise, files are parsed in parallel.
func (*KotlinParser) ParseFile ¶
func (p *KotlinParser) ParseFile(path string) (*parser.FileMetrics, error)
ParseFile parses a single Kotlin file and extracts comprehensive metrics.