You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
helm/pkg/lint/rules/ignore.go

28 lines
651 B

package rules
import (
"bufio"
"os"
"strings"
)
// ParseIgnoreFile reads and parses the .helmlintignore file, returning a list of patterns
func ParseIgnoreFile(filePath string) ([]string, error) {
var patterns []string
file, err := os.Open(filePath)
if err != nil {
return nil, err
}
defer file.Close()
scanner := bufio.NewScanner(file)
for scanner.Scan() {
line := strings.TrimSpace(scanner.Text())
if line != "" && !strings.HasPrefix(line, "#") { // Ignore comments and empty lines
patterns = append(patterns, line)
}
}
return patterns, scanner.Err()
}