kotlin

package
v1.4.0-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 26, 2026 License: MIT Imports: 15 Imported by: 0

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

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

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

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.

func (*KotlinLanguage) Name

func (k *KotlinLanguage) Name() string

Name returns "kotlin".

func (*KotlinLanguage) Parser

func (k *KotlinLanguage) Parser(workers int) parser.Parser

Parser returns a tree-sitter based Kotlin parser with the specified number of workers.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL