Documentation
¶
Index ¶
- func Analyze(ctx context.Context, rootPath string, filter *Filter) (*model.Stats, error)
- func AnalyzeFiles(ctx context.Context, rootPath string, filter *Filter) (*model.Stats, error)
- func AnalyzeGit(ctx context.Context, rootPath string, filter *Filter) (*model.Stats, error)
- func CountLines(filePath string) (int, error)
- func GetRepoRoot(path string) (string, error)
- func IsGitRepo(path string) bool
- func ShouldWarnLargeDirectory(path string) (bool, string)
- func ValidatePath(path string) error
- type Analyzer
- type FileAnalyzer
- type Filter
- type GitAnalyzer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnalyzeFiles ¶
AnalyzeFiles analyzes files in a non-git directory
func AnalyzeGit ¶
AnalyzeGit analyzes a git repository for changes
func CountLines ¶
CountLines counts the number of lines in a file using chunked reading Returns 0 for binary files (detected by null bytes in first chunk)
func GetRepoRoot ¶
GetRepoRoot returns the root path of the git repository
func ShouldWarnLargeDirectory ¶ added in v1.0.1
ShouldWarnLargeDirectory checks if we should warn the user about analyzing a large directory
func ValidatePath ¶ added in v1.0.1
ValidatePath checks if the given path is safe to analyze Returns an error if the path is considered dangerous
Types ¶
type Analyzer ¶
type Analyzer interface {
Analyze(ctx context.Context, rootPath string, filter *Filter) (*model.Stats, error)
}
Analyzer defines the interface for analyzing file statistics
func GetAnalyzer ¶
GetAnalyzer returns the appropriate analyzer based on whether the path is a Git repository
type FileAnalyzer ¶
type FileAnalyzer struct{}
FileAnalyzer implements Analyzer for non-Git directories
func NewFileAnalyzer ¶
func NewFileAnalyzer() *FileAnalyzer
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
Filter handles file exclusion logic
func NewFilter ¶
func NewFilter(allowedExts []string, customExcludes []string, respectGitignore bool, excludeTests bool) *Filter
NewFilter creates a new filter with default or custom settings
func (*Filter) LoadGitignore ¶
LoadGitignore parses .gitignore file and loads patterns
func (*Filter) ShouldInclude ¶
ShouldInclude checks if a file should be included based on all filters