Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ASTParser ¶
type ASTParser struct{}
ASTParser implements Parser using Go's AST packages
func (*ASTParser) ParseDirectory ¶
func (p *ASTParser) ParseDirectory(rootPath string, excludePatterns []string) ([]*FileMetrics, []error)
ParseDirectory recursively finds and parses all Go files in a directory
type FileMetrics ¶
type FileMetrics struct {
FilePath string // Absolute or relative path to the file
PackageName string // Package declaration
TotalLines int // Total lines in the file
CodeLines int // Lines with actual code (excluding blank and comments)
CommentLines int // Lines with comments
BlankLines int // Blank lines
Functions []*FunctionMetrics // All functions/methods in the file
Imports []string // Import paths
}
FileMetrics contains metrics extracted from a single Go file
func (*FileMetrics) CodeRatio ¶
func (fm *FileMetrics) CodeRatio() float64
CodeRatio calculates the ratio of code lines to total lines
func (*FileMetrics) CommentRatio ¶
func (fm *FileMetrics) CommentRatio() float64
CommentRatio calculates the ratio of comment lines to total lines
type FunctionMetrics ¶
type FunctionMetrics struct {
Name string // Function name
ReceiverType string // Empty if not a method, otherwise the receiver type
StartLine int // Line number where function starts
EndLine int // Line number where function ends
Lines int // Total lines in function body
Parameters int // Number of parameters
ReturnValues int // Number of return values
Complexity int // Simple cyclomatic complexity (Phase 1: basic count)
}
FunctionMetrics contains metrics for a single function or method
func (*FunctionMetrics) FullName ¶
func (fm *FunctionMetrics) FullName() string
FullName returns the full function name including receiver for methods
func (*FunctionMetrics) IsMethod ¶
func (fm *FunctionMetrics) IsMethod() bool
IsMethod returns true if this is a method (has a receiver)
type Parser ¶
type Parser interface {
// ParseFile parses a single Go file and returns its metrics
ParseFile(path string) (*FileMetrics, error)
// ParseDirectory recursively parses all Go files in a directory
// Returns metrics for all successfully parsed files and any errors encountered
ParseDirectory(path string, excludePatterns []string) ([]*FileMetrics, []error)
}
Parser defines the interface for parsing Go source files
Click to show internal directories.
Click to hide internal directories.