add the isignored file and fixed the ignore rules a bit

Signed-off-by: Danilo Patrucco <danilo.patrucco@gmail.com>
pull/13205/head
Danilo Patrucco 1 year ago
parent 1eaae6de39
commit ac283a5587

@ -18,8 +18,6 @@ package lint
import (
"path/filepath"
"os"
"helm.sh/helm/v3/pkg/chartutil"
"helm.sh/helm/v3/pkg/lint/rules"
"helm.sh/helm/v3/pkg/lint/support"

@ -0,0 +1,23 @@
package rules
import (
"path/filepath"
"strings"
)
func IsIgnored(path string, patterns []string) bool {
for _, pattern := range patterns {
cleanedPath := filepath.Clean(path)
cleanedPattern := filepath.Clean(pattern)
if match, err := filepath.Match(cleanedPattern, cleanedPath); err == nil && match {
return true
}
if strings.HasSuffix(cleanedPattern, "/") || strings.HasSuffix(cleanedPattern, "\\") {
patternDir := strings.TrimRight(cleanedPattern, "/\\")
if strings.HasPrefix(cleanedPath, patternDir) {
return true
}
}
}
return false
}
Loading…
Cancel
Save