Skip to content

Commit

Permalink
Fix: yml is valid type (#206)
Browse files Browse the repository at this point in the history
* Fix: yml is valid type

* Make file extension matching case-insensitive

* make exclude-file-types string lowercase before using it

---------

Co-authored-by: Clayton Kehoe <[email protected]>
  • Loading branch information
gurukiran07 and kehoecj authored Oct 30, 2024
1 parent decfab8 commit ae1ed65
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/validator/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ func validatorUsage() {
func getFileTypes() []string {
options := make([]string, 0, len(filetype.FileTypes))
for _, typ := range filetype.FileTypes {
options = append(options, typ.Name)
for extName := range typ.Extensions {
options = append(options, extName)
}
}
sort.Strings(options)
return options
Expand Down Expand Up @@ -154,6 +156,7 @@ Supported formats: standard, json, junit (default: "standard")`,
}

if *excludeFileTypesPtr != "" {
*excludeFileTypesPtr = strings.ToLower(*excludeFileTypesPtr)
if !validateFileTypeList(strings.Split(*excludeFileTypesPtr, ",")) {
return validatorConfig{}, errors.New("Invalid exclude file type")
}
Expand Down

0 comments on commit ae1ed65

Please sign in to comment.