mirror of
https://github.com/helm/helm.git
synced 2026-05-28 04:35:48 -04:00
Merge pull request #1162 from adamreese/fix/1161-lint-txt
fix(lint): allow .txt files
This commit is contained in:
commit
436c9dd275
2 changed files with 5 additions and 5 deletions
|
|
@ -149,7 +149,7 @@ func validateQuotes(templateContent string) error {
|
|||
|
||||
func validateAllowedExtension(fileName string) error {
|
||||
ext := filepath.Ext(fileName)
|
||||
validExtensions := []string{".yaml", ".tpl"}
|
||||
validExtensions := []string{".yaml", ".tpl", ".txt"}
|
||||
|
||||
for _, b := range validExtensions {
|
||||
if b == ext {
|
||||
|
|
@ -157,7 +157,7 @@ func validateAllowedExtension(fileName string) error {
|
|||
}
|
||||
}
|
||||
|
||||
return fmt.Errorf("file extension '%s' not valid. Valid extensions are .yaml or .tpl", ext)
|
||||
return fmt.Errorf("file extension '%s' not valid. Valid extensions are .yaml, .tpl, or .txt", ext)
|
||||
}
|
||||
|
||||
// validateNoMissingValues checks that all the {{}} functions returns a non empty value (<no value> or "")
|
||||
|
|
|
|||
|
|
@ -31,11 +31,11 @@ func TestValidateAllowedExtension(t *testing.T) {
|
|||
var failTest = []string{"/foo", "/test.yml", "/test.toml", "test.yml"}
|
||||
for _, test := range failTest {
|
||||
err := validateAllowedExtension(test)
|
||||
if err == nil || !strings.Contains(err.Error(), "Valid extensions are .yaml or .tpl") {
|
||||
t.Errorf("validateAllowedExtension('%s') to return \"Valid extensions are .yaml or .tpl\", got no error", test)
|
||||
if err == nil || !strings.Contains(err.Error(), "Valid extensions are .yaml, .tpl, or .txt") {
|
||||
t.Errorf("validateAllowedExtension('%s') to return \"Valid extensions are .yaml, .tpl, or .txt\", got no error", test)
|
||||
}
|
||||
}
|
||||
var successTest = []string{"/foo.yaml", "foo.yaml", "foo.tpl", "/foo/bar/baz.yaml"}
|
||||
var successTest = []string{"/foo.yaml", "foo.yaml", "foo.tpl", "/foo/bar/baz.yaml", "NOTES.txt"}
|
||||
for _, test := range successTest {
|
||||
err := validateAllowedExtension(test)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue