warn on templates in libraries that will be skipped

pull/11629/head
Brian Dols 4 years ago
parent 1e98e1bfde
commit 8c85371a35

@ -99,6 +99,9 @@ func Templates(linter *support.Linter, values map[string]interface{}, namespace
for _, template := range chart.Templates {
fileName, data := template.Name, template.Data
fpath = fileName
if chart.Metadata.Type == "library" {
linter.RunLinterRule(support.WarningSev, fpath, validateLibraryTemplate(fileName))
}
linter.RunLinterRule(support.ErrorSev, fpath, validateAllowedExtension(fileName))
// These are v3 specific checks to make sure and warn people if their
@ -179,6 +182,13 @@ func validateTopIndentLevel(content string) error {
return scanner.Err()
}
func validateLibraryTemplate(fileName string) error {
if fileName[0] != '_' {
return fmt.Errorf("template file name %s does not start with '_' character", fileName)
}
return nil
}
// Validation functions
func validateTemplatesDir(templatesPath string) error {
if fi, err := os.Stat(templatesPath); err != nil {

Loading…
Cancel
Save