Skip to content

Commit dbeb2a2

Browse files
authored
Merge pull request #235 from adam-golab/master
Changed ignored_filename_patterns to ignored_path_patterns
2 parents 9b9f26f + 0ccb69e commit dbeb2a2

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

main.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ var (
2828
commit = "none"
2929
date = "unknown"
3030
directories = []string{}
31-
ignoredFilenamePatterns = []string{}
31+
ignoredPathPatterns = []string{}
3232

3333
// forceColor tells kubeval to use colored output even if
3434
// stdout is not a TTY
@@ -175,9 +175,9 @@ func hasErrors(res []kubeval.ValidationResult) bool {
175175
}
176176

177177
// isIgnored returns whether the specified filename should be ignored.
178-
func isIgnored(filename string) (bool, error) {
179-
for _, p := range ignoredFilenamePatterns {
180-
m, err := regexp.MatchString(p, filename)
178+
func isIgnored(path string) (bool, error) {
179+
for _, p := range ignoredPathPatterns {
180+
m, err := regexp.MatchString(p, path)
181181
if err != nil {
182182
return false, err
183183
}
@@ -198,7 +198,7 @@ func aggregateFiles(args []string) ([]string, error) {
198198
if err != nil {
199199
return err
200200
}
201-
ignored, err := isIgnored(info.Name())
201+
ignored, err := isIgnored(path)
202202
if err != nil {
203203
return err
204204
}
@@ -240,8 +240,9 @@ func init() {
240240
RootCmd.Flags().BoolVarP(&forceColor, "force-color", "", false, "Force colored output even if stdout is not a TTY")
241241
RootCmd.SetVersionTemplate(`{{.Version}}`)
242242
RootCmd.Flags().StringSliceVarP(&directories, "directories", "d", []string{}, "A comma-separated list of directories to recursively search for YAML documents")
243-
RootCmd.Flags().StringSliceVarP(&ignoredFilenamePatterns, "ignored-filename-patterns", "i", []string{}, "A comma-separated list of regular expressions specifying filenames to ignore")
244-
243+
RootCmd.Flags().StringSliceVarP(&ignoredPathPatterns, "ignored-path-patterns", "i", []string{}, "A comma-separated list of regular expressions specifying paths to ignore")
244+
RootCmd.Flags().StringSliceVarP(&ignoredPathPatterns, "ignored-filename-patterns", "", []string{}, "An alias for ignored-path-patterns")
245+
245246
viper.SetEnvPrefix("KUBEVAL")
246247
viper.AutomaticEnv()
247248
viper.BindPFlag("schema_location", RootCmd.Flags().Lookup("schema-location"))

0 commit comments

Comments
 (0)