HIP-0019 adds .helmlintignore
functionality to pkg/lint
#13257
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
Adds
pkg/lint/ignore
as proposed in HIP-0019 (helm/community#353). Closes #13133.By adding a
.helmlintignore
file at the root of a chart,helm lint
can be made to suppress unwanted errors. Ignored lint results (bothsupport.Message
anderror
types can be ignored) will not show up in thehelm
command's printable output and will not be allowed to "fail" a lint by returning a nonzero error code.Sample execution with and without the ignorer
Without the ignorer:
With the this branch's new
pkg/lint/ignore
in place:Example
.helmlintignore
fileIgnorer
's matchers can easily associate an error string with a specific file path then the more tightly-scopedoffending-file-name.yaml error message to ignore here
ignore form works as above.error_lint_ignore=message i don't want to see right now
form as a fallback.Special notes for your reviewer:
pkg/lint/ignore
'sIgnorer
is the primary entrypoint, and is threaded throughcmd/helm/lint.go
andpkg/action/lint.go
accordinglyIgnorer
presents aMatchesErrors
interface as an extensible method of registering ignore rules. While we only include some fairly simple ignore rule syntax (seepkg/lint/ignore/rule_loaders
) in this PR it should be straightforward to layer in more complex ignore rule parsing in future PRs if needed.On more complex ignore rules
More advanced lint result suppression (e.g. adding short codes to every possible linter response so end users could try a
--ignore-lint-type=E123
will may require a more thorough refactoring of the entirelint
package which we did not want to attempt just yet given the 50+ existing error signatures (rg "return.*errors\.Wrap" pkg/action | wc -l
gets 54 lines at the moment)Companion PR for end user documentation
See helm/helm-www#1617
If applicable:
docs needed
label should be applied if so)Co-authored-by: Danilo Patrucco danilo.patrucco@gmail.com