scanner

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: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterBySize

func FilterBySize(files []string, maxSize int64) ([]string, int)

FilterBySize filters files that exceed the configured maximum size. Returns the filtered list and the count of files that were skipped. If maxSize is 0, returns the original list unchanged.

Types

type Scanner

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

Scanner finds source files in a directory.

func NewScanner

func NewScanner(cfg *config.Config) *Scanner

NewScanner creates a new file scanner.

func (*Scanner) FilterByLanguage

func (s *Scanner) FilterByLanguage(files []string, lang parser.Language) []string

FilterByLanguage filters files to only those of a specific language.

func (*Scanner) GroupByLanguage

func (s *Scanner) GroupByLanguage(files []string) map[parser.Language][]string

GroupByLanguage groups files by their detected language.

func (*Scanner) ScanDir

func (s *Scanner) ScanDir(root string) ([]string, error)

ScanDir recursively scans a directory for source files. Uses filepath.WalkDir for better performance (avoids stat calls). Validates that all paths stay within the root directory to prevent traversal attacks.

func (*Scanner) ScanFile

func (s *Scanner) ScanFile(path string) (bool, error)

ScanFile checks if a single file should be analyzed.

Jump to

Keyboard shortcuts

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