diff --git a/README.md b/README.md index cb17123..4a684e5 100644 --- a/README.md +++ b/README.md @@ -240,7 +240,7 @@ To use `helmfmt` as a pre-commit hook, add the following to your `.pre-commit-co ```yaml repos: - repo: https://github.com/digitalstudium/helmfmt - rev: v0.4.0 + rev: v0.4.1 hooks: - id: helmfmt ``` diff --git a/VERSION b/VERSION index 1d0ba9e..267577d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.4.0 +0.4.1 diff --git a/format.go b/format.go index be2ccda..39289f0 100644 --- a/format.go +++ b/format.go @@ -32,7 +32,7 @@ var ( commentEndRe = regexp.MustCompile(`\*\/(?:}}|\s-}})`) // Паттерны для определения типов токенов - varRe = regexp.MustCompile(`^\s*\$`) + varRe = regexp.MustCompile(`^\s*\$\w+\s*:=`) controlRe = regexp.MustCompile(`^\s*(if|range|with|define|block)\b`) elseRe = regexp.MustCompile(`^\s*else\b`) endRe = regexp.MustCompile(`^\s*end\b`) diff --git a/templates_test/templates/control_with_comment.yaml b/templates_test/templates/control_with_comment.yaml index f5bf8ea..099550c 100644 --- a/templates_test/templates/control_with_comment.yaml +++ b/templates_test/templates/control_with_comment.yaml @@ -1,4 +1,5 @@ {{- if .Values.enabled }} {{/* This is a comment */}} {{- $var := .Values.someValue }} +{{ $var.foo | toYaml | indent 8 }} {{- end }} diff --git a/templates_test/templates_expected/control_with_comment.yaml b/templates_test/templates_expected/control_with_comment.yaml index 8f1e900..95322e8 100644 --- a/templates_test/templates_expected/control_with_comment.yaml +++ b/templates_test/templates_expected/control_with_comment.yaml @@ -1,4 +1,5 @@ {{- if .Values.enabled }} {{/* This is a comment */}} {{- $var := .Values.someValue }} +{{ $var.foo | toYaml | indent 8 }} {{- end }}