detector

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package detector provides language and tool detection capabilities for code quality analysis.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnalysisResult

type AnalysisResult struct {
	// ProjectRoot is the root directory of the project
	ProjectRoot string

	// Languages contains detected languages with their files
	Languages map[string][]string

	// AvailableTools lists tools that are installed and available
	AvailableTools []string

	// RecommendedTools suggests tools for the detected languages
	RecommendedTools map[string][]string

	// ConfigFiles maps tool names to their configuration files
	ConfigFiles map[string]string

	// Issues contains any problems detected during analysis
	Issues []string
}

AnalysisResult contains the results of project analysis.

type ConfigFileDetector

type ConfigFileDetector struct{}

ConfigFileDetector finds configuration files for quality tools.

func NewConfigFileDetector

func NewConfigFileDetector() *ConfigFileDetector

NewConfigFileDetector creates a new configuration file detector.

func (*ConfigFileDetector) FindConfigs

func (d *ConfigFileDetector) FindConfigs(projectRoot string, toolList []tools.QualityTool) map[string]string

FindConfigs searches for tool configuration files.

func (*ConfigFileDetector) ValidateConfig

func (d *ConfigFileDetector) ValidateConfig(toolName, configPath string) error

ValidateConfig checks if a configuration file is valid.

type FileTypeDetector

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

FileTypeDetector implements language detection based on file types and project indicators.

func NewFileTypeDetector

func NewFileTypeDetector() *FileTypeDetector

NewFileTypeDetector creates a new language detector with default rules.

func (*FileTypeDetector) DetectLanguages

func (d *FileTypeDetector) DetectLanguages(projectRoot string) ([]string, error)

DetectLanguages scans a directory and returns detected languages.

func (*FileTypeDetector) GetFilesByLanguage

func (d *FileTypeDetector) GetFilesByLanguage(projectRoot string, languages []string) (map[string][]string, error)

GetFilesByLanguage returns files grouped by language.

type LanguageInfo

type LanguageInfo struct {
	Name       string            // Language name (e.g., "Go", "Python")
	Extensions []string          // File extensions (e.g., [".go", ".mod"])
	Files      []string          // Detected files
	Indicators []string          // Project indicators (e.g., ["go.mod", "main.go"])
	Confidence float64           // Detection confidence (0.0 - 1.0)
	Metadata   map[string]string // Additional metadata
}

LanguageInfo contains information about a detected language.

type LanguageRule

type LanguageRule struct {
	Name       string            // Language name
	Extensions []string          // File extensions to look for
	Indicators []string          // Project files that indicate this language
	Keywords   []string          // Keywords to look for in files
	Patterns   []string          // File name patterns
	MinFiles   int               // Minimum files needed for detection
	Weight     float64           // Base weight for confidence calculation
	Metadata   map[string]string // Additional metadata
}

LanguageRule defines how to detect a specific language.

type ProjectAnalyzer

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

ProjectAnalyzer analyzes a project to determine quality tool setup.

func NewProjectAnalyzer

func NewProjectAnalyzer() *ProjectAnalyzer

NewProjectAnalyzer creates a new project analyzer.

func (*ProjectAnalyzer) AnalyzeProject

func (a *ProjectAnalyzer) AnalyzeProject(projectRoot string, registry tools.ToolRegistry) (*AnalysisResult, error)

AnalyzeProject performs comprehensive project analysis.

func (*ProjectAnalyzer) GetOptimalToolSelection

func (a *ProjectAnalyzer) GetOptimalToolSelection(result *AnalysisResult, registry tools.ToolRegistry) map[string][]tools.QualityTool

GetOptimalToolSelection returns the best tools for each language.

type SystemToolDetector

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

SystemToolDetector detects available quality tools on the system.

func NewSystemToolDetector

func NewSystemToolDetector() *SystemToolDetector

NewSystemToolDetector creates a new system tool detector.

func (*SystemToolDetector) GetToolVersion

func (d *SystemToolDetector) GetToolVersion(toolName string) string

GetToolVersion returns the version of a tool if available.

func (*SystemToolDetector) IsToolAvailable

func (d *SystemToolDetector) IsToolAvailable(toolName string) bool

IsToolAvailable checks if a tool is available on the system.

Jump to

Keyboard shortcuts

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