Merge pull request #1368 from prydonius/1367-fix-linter-tmpl-regex

fix(lint): validateNoMissingValues template regex
reviewable/pr1375/r1
Matt Butcher 8 years ago committed by GitHub
commit 70b29a47d0

@ -154,12 +154,17 @@ func validateNoMissingValues(templatesPath string, chartValues chartutil.Values,
// 2 - Extract every function and execute them against the loaded values // 2 - Extract every function and execute them against the loaded values
// Supported {{ .Chart.Name }}, {{ .Chart.Name | quote }} // Supported {{ .Chart.Name }}, {{ .Chart.Name | quote }}
r, _ := regexp.Compile(`{{[\w|\.|\s|\|\"|\']+}}`) r, _ := regexp.Compile(`{{[\w.\s|"'-]+}}`)
functions := r.FindAllString(string(templateContent), -1) functions := r.FindAllString(string(templateContent), -1)
skipRegex, _ := regexp.Compile(`if|else|end`)
// Iterate over the {{ FOO }} templates, executing them against the chartValues // Iterate over the {{ FOO }} templates, executing them against the chartValues
// We do individual templates parsing so we keep the reference for the key (str) that we want it to be interpolated. // We do individual templates parsing so we keep the reference for the key (str) that we want it to be interpolated.
for _, str := range functions { for _, str := range functions {
if skipRegex.MatchString(str) {
continue
}
newtmpl, err := tmpl.Parse(str) newtmpl, err := tmpl.Parse(str)
if err != nil { if err != nil {
return err return err

Loading…
Cancel
Save