golang

package
v0.0.0-...-e39e4f3 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2026 License: Unlicense Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ASTCache

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

func NewASTCache

func NewASTCache(maxAge time.Duration) *ASTCache

func (*ASTCache) Get

func (c *ASTCache) Get(filePath string) (*ast.File, *token.FileSet, bool)

func (*ASTCache) Invalidate

func (c *ASTCache) Invalidate(filePath string)

func (*ASTCache) InvalidateAll

func (c *ASTCache) InvalidateAll()

func (*ASTCache) Set

func (c *ASTCache) Set(filePath string, file *ast.File, fset *token.FileSet)

func (*ASTCache) Size

func (c *ASTCache) Size() int

func (*ASTCache) Stats

func (c *ASTCache) Stats() CacheStats

type Analyzer

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

Analyzer implements the core.Analyzer interface for Go

func NewAnalyzer

func NewAnalyzer(config core.Config) *Analyzer

NewAnalyzer creates a new Go analyzer

func (*Analyzer) Analyze

func (a *Analyzer) Analyze(ctx context.Context, filePath string, config core.Config) ([]core.Result, error)

Analyze analyzes a Go file and returns results

func (*Analyzer) Name

func (a *Analyzer) Name() string

Name returns the name of this analyzer

func (*Analyzer) SupportedExtensions

func (a *Analyzer) SupportedExtensions() []string

SupportedExtensions returns the file extensions supported by this analyzer

type CacheStats

type CacheStats struct {
	Entries  int
	MaxAge   time.Duration
	MinAge   time.Duration
	AvgAge   time.Duration
	TotalAge time.Duration
}

type CrossFileAnalyzer

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

func NewCrossFileAnalyzer

func NewCrossFileAnalyzer() *CrossFileAnalyzer

func (*CrossFileAnalyzer) AnalyzeDirectory

func (a *CrossFileAnalyzer) AnalyzeDirectory(ctx context.Context, dirPath string) error

func (*CrossFileAnalyzer) FindUnusedFunctions

func (a *CrossFileAnalyzer) FindUnusedFunctions() []core.Result

func (*CrossFileAnalyzer) GetCallGraph

func (a *CrossFileAnalyzer) GetCallGraph() map[string][]string

type FileScanner

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

FileScanner scans directories for Go files

func NewFileScanner

func NewFileScanner() *FileScanner

NewFileScanner creates a new Go file scanner

func (*FileScanner) Scan

func (s *FileScanner) Scan(ctx context.Context, rootPath string) ([]string, error)

Scan scans a directory for Go files

func (*FileScanner) ScanForRegistry

func (s *FileScanner) ScanForRegistry(ctx context.Context, rootPath string, registry *languages.Registry) (map[string][]string, error)

ScanForRegistry scans a directory and groups files by language

type FunctionInfo

type FunctionInfo struct {
	Name     string
	File     string
	Exported bool
	IsMain   bool
	IsTest   bool
	IsInit   bool
	IsMethod bool
	Receiver string // receiver type name for methods
	Line     int
	Package  string
}

type ParallelAnalyzer

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

func NewParallelAnalyzer

func NewParallelAnalyzer(config core.Config, workers int) *ParallelAnalyzer

func (*ParallelAnalyzer) Analyze

func (a *ParallelAnalyzer) Analyze(ctx context.Context, filePath string, config core.Config) ([]core.Result, error)

func (*ParallelAnalyzer) AnalyzeFiles

func (a *ParallelAnalyzer) AnalyzeFiles(ctx context.Context, filePaths []string, config core.Config) []core.Result

func (*ParallelAnalyzer) Name

func (a *ParallelAnalyzer) Name() string

func (*ParallelAnalyzer) SupportedExtensions

func (a *ParallelAnalyzer) SupportedExtensions() []string

func (*ParallelAnalyzer) WorkerCount

func (a *ParallelAnalyzer) WorkerCount() int

type Parser

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

func NewParser

func NewParser(config core.Config) *Parser

func (*Parser) CalculateFunctionMetrics

func (p *Parser) CalculateFunctionMetrics(ctx context.Context, funcDecl *ast.FuncDecl, fset *token.FileSet, file *ast.File) (*rules.FunctionMetrics, error)

func (*Parser) CalculateMetrics

func (p *Parser) CalculateMetrics(ctx context.Context, filePath string, file *ast.File) (*rules.FileMetrics, error)

func (*Parser) ParseFile

func (p *Parser) ParseFile(ctx context.Context, filePath string) (*ast.File, *token.FileSet, error)

func (*Parser) SetCache

func (p *Parser) SetCache(cache *ASTCache)

type Similarity

type Similarity struct {
	File1      string
	Line1      int
	File2      string
	Line2      int
	Similarity float64
	Message    string
	Suggestion string
}

type SimilarityAnalyzer

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

func NewSimilarityAnalyzer

func NewSimilarityAnalyzer() *SimilarityAnalyzer

func (*SimilarityAnalyzer) AnalyzeDirectory

func (a *SimilarityAnalyzer) AnalyzeDirectory(ctx context.Context, dirPath string, threshold float64) ([]core.Result, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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