python

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package python provides Python language support for code analysis.

Package python provides Python language support for code analysis.

Package python provides Python language support for code analysis.

This package implements the language.Language interface for Python, 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 PythonDetectorRunner

type PythonDetectorRunner struct {
	// contains filtered or unexported fields
}

PythonDetectorRunner implements language.DetectorRunner for Python source code.

This runner uses tree-sitter to parse Python files and run anti-pattern detection, similar to how GoDetectorRunner works with Go AST.

func NewDetectorRunner

func NewDetectorRunner(cfg *config.AnalysisConfig) *PythonDetectorRunner

NewDetectorRunner creates a new detector runner for Python source code.

func (*PythonDetectorRunner) RunDetectors

RunDetectors parses a Python file and runs all enabled detectors.

type PythonLanguage

type PythonLanguage struct{}

PythonLanguage implements language.Language for Python source code.

func (*PythonLanguage) CoverageRunner

func (p *PythonLanguage) CoverageRunner(cfg *config.AnalysisConfig, statusReporter status.Reporter) language.CoverageRunner

CoverageRunner returns nil as Python coverage is not yet implemented. Python coverage support will be added in a future phase using pytest-cov.

func (*PythonLanguage) DefaultExcludePatterns

func (p *PythonLanguage) DefaultExcludePatterns() []string

DefaultExcludePatterns returns Python-specific exclude patterns.

func (*PythonLanguage) DependencyAnalyzer

func (p *PythonLanguage) DependencyAnalyzer(projectPath string) (language.DependencyAnalyzer, error)

DependencyAnalyzer returns nil as Python dependency analysis is not yet implemented. Python dependency analysis will be added in a future phase using requirements.txt/pyproject.toml parsing.

func (*PythonLanguage) DetectorRunner

DetectorRunner returns a Python-specific detector runner.

func (*PythonLanguage) DisplayName

func (p *PythonLanguage) DisplayName() string

DisplayName returns "Python".

func (*PythonLanguage) Extensions

func (p *PythonLanguage) Extensions() []string

Extensions returns [".py"].

func (*PythonLanguage) Name

func (p *PythonLanguage) Name() string

Name returns "python".

func (*PythonLanguage) Parser

func (p *PythonLanguage) Parser() parser.Parser

Parser returns a tree-sitter based Python parser.

type PythonParser

type PythonParser struct {
	// contains filtered or unexported fields
}

PythonParser implements parser.Parser for Python source files using tree-sitter.

func NewParser

func NewParser() *PythonParser

NewParser creates a new Python parser.

func (*PythonParser) ParseDirectory

func (p *PythonParser) ParseDirectory(rootPath string, excludePatterns []string, extensions []string, statusReporter status.Reporter) ([]*parser.FileMetrics, []error)

ParseDirectory recursively parses all Python files in a directory.

func (*PythonParser) ParseFile

func (p *PythonParser) ParseFile(path string) (*parser.FileMetrics, error)

ParseFile parses a single Python file and extracts comprehensive metrics.

Jump to

Keyboard shortcuts

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