analysis

package
v1.7.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChurnOptions

type ChurnOptions struct {
	Days    int
	Top     int
	Spinner *progress.Tracker
}

ChurnOptions configures churn analysis.

type CohesionOptions

type CohesionOptions struct {
	IncludeTests bool
	Sort         string
	Top          int
	OnProgress   func()
}

CohesionOptions configures cohesion analysis.

type ComplexityOptions

type ComplexityOptions struct {
	IncludeHalstead     bool
	CyclomaticThreshold int
	CognitiveThreshold  int
	FunctionsOnly       bool
	MaxFileSize         int64
	OnProgress          func()
}

ComplexityOptions configures complexity analysis.

type DeadCodeOptions

type DeadCodeOptions struct {
	Confidence float64
	OnProgress func()
}

DeadCodeOptions configures dead code detection.

type DefectOptions

type DefectOptions struct {
	HighRiskOnly bool
	ChurnDays    int
	MaxFileSize  int64
}

DefectOptions configures defect prediction.

type DuplicatesOptions

type DuplicatesOptions struct {
	MinLines            int
	SimilarityThreshold float64
	OnProgress          func()
}

DuplicatesOptions configures duplicate detection.

type GraphOptions

type GraphOptions struct {
	Scope          analyzer.GraphScope
	IncludeMetrics bool
	OnProgress     func()
}

GraphOptions configures dependency graph analysis.

type HotspotOptions

type HotspotOptions struct {
	Days        int
	Top         int
	MaxFileSize int64
	OnProgress  func()
}

HotspotOptions configures hotspot analysis.

type Option

type Option func(*Service)

Option configures a Service.

func WithConfig

func WithConfig(cfg *config.Config) Option

WithConfig sets the configuration.

func WithOpener

func WithOpener(opener vcs.Opener) Option

WithOpener sets the VCS opener (for testing).

type OwnershipOptions

type OwnershipOptions struct {
	Top            int
	IncludeTrivial bool
	OnProgress     func()
}

OwnershipOptions configures ownership analysis.

type PatternConfig

type PatternConfig struct {
	Pattern  string
	Category models.DebtCategory
	Severity models.Severity
}

PatternConfig defines a custom SATD pattern.

type PatternError

type PatternError struct {
	Pattern string
	Err     error
}

PatternError indicates an invalid pattern.

func (*PatternError) Error

func (e *PatternError) Error() string

func (*PatternError) Unwrap

func (e *PatternError) Unwrap() error

type RepoMapOptions

type RepoMapOptions struct {
	Top int
}

RepoMapOptions configures repo map generation.

type SATDOptions

type SATDOptions struct {
	IncludeTests   bool
	StrictMode     bool
	CustomPatterns []PatternConfig
	OnProgress     func()
}

SATDOptions configures SATD analysis.

type Service

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

Service orchestrates code analysis operations.

func New

func New(opts ...Option) *Service

New creates a new analysis service.

func (*Service) AnalyzeChurn

func (s *Service) AnalyzeChurn(repoPath string, opts ChurnOptions) (*models.ChurnAnalysis, error)

AnalyzeChurn analyzes git commit history for file churn.

func (*Service) AnalyzeCohesion

func (s *Service) AnalyzeCohesion(files []string, opts CohesionOptions) (*models.CohesionAnalysis, error)

AnalyzeCohesion calculates CK (Chidamber-Kemerer) OO metrics.

func (*Service) AnalyzeComplexity

func (s *Service) AnalyzeComplexity(files []string, opts ComplexityOptions) (*models.ComplexityAnalysis, error)

AnalyzeComplexity runs complexity analysis on the given files.

func (*Service) AnalyzeDeadCode

func (s *Service) AnalyzeDeadCode(files []string, opts DeadCodeOptions) (*models.DeadCodeAnalysis, error)

AnalyzeDeadCode detects potentially unused code.

func (*Service) AnalyzeDefects

func (s *Service) AnalyzeDefects(repoPath string, files []string, opts DefectOptions) (*models.DefectAnalysis, error)

AnalyzeDefects predicts defect probability.

func (*Service) AnalyzeDuplicates

func (s *Service) AnalyzeDuplicates(files []string, opts DuplicatesOptions) (*models.CloneAnalysis, error)

AnalyzeDuplicates detects code clones.

func (*Service) AnalyzeGraph

func (s *Service) AnalyzeGraph(files []string, opts GraphOptions) (*models.DependencyGraph, *models.GraphMetrics, error)

AnalyzeGraph builds a dependency graph.

func (*Service) AnalyzeHotspots

func (s *Service) AnalyzeHotspots(repoPath string, files []string, opts HotspotOptions) (*models.HotspotAnalysis, error)

AnalyzeHotspots identifies code hotspots (high churn + high complexity).

func (*Service) AnalyzeOwnership

func (s *Service) AnalyzeOwnership(repoPath string, files []string, opts OwnershipOptions) (*models.OwnershipAnalysis, error)

AnalyzeOwnership calculates code ownership and bus factor.

func (*Service) AnalyzeRepoMap

func (s *Service) AnalyzeRepoMap(files []string, opts RepoMapOptions) (*models.RepoMap, error)

AnalyzeRepoMap generates a PageRank-ranked symbol map.

func (*Service) AnalyzeSATD

func (s *Service) AnalyzeSATD(files []string, opts SATDOptions) (*models.SATDAnalysis, error)

AnalyzeSATD runs self-admitted technical debt analysis.

func (*Service) AnalyzeTDG

func (s *Service) AnalyzeTDG(path string) (*models.ProjectScore, error)

AnalyzeTDG calculates Technical Debt Gradient scores.

func (*Service) AnalyzeTemporalCoupling

func (s *Service) AnalyzeTemporalCoupling(repoPath string, opts TemporalCouplingOptions) (*models.TemporalCouplingAnalysis, error)

AnalyzeTemporalCoupling identifies files that frequently change together.

type TDGOptions

type TDGOptions struct {
	Hotspots      int
	ShowPenalties bool
}

TDGOptions configures TDG analysis.

type TemporalCouplingOptions

type TemporalCouplingOptions struct {
	Days         int
	MinCochanges int
	Top          int
}

TemporalCouplingOptions configures temporal coupling analysis.

Jump to

Keyboard shortcuts

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