processing: apply onbuild rule wrapper per rule#799
Merged
lorenzo merged 1 commit intohadolint:masterfrom Mar 20, 2022
Merged
Conversation
- Apply `onbuild` wrapper per-rule rather than on all rules combined - Apply `onbuild` wrapper only for rules needing it - Inline rules _and_ their `onbuild` wrapped counterparts - Test for DL3047 also when inside an `ONBUILD` statement The `onbuild` wrapper makes sure a rule is also applied to the AST branch inside an `ONBUILD` instruction. But this is not necessary for all rules, for example rules dealing exclusively with `FROM` instructions need not be applied because that would be invalid syntax anyways. Moving the `onbuild` wrapper to apply to each rule individually instead of the fold of all rules permits granular control over which rules are applied inside of an `ONBUILD` instruction and crucially also enables the ability to not apply rules on the AST branch inside of an `ONBUILD` instruction, if so desired. In addition to that the inlining for the rules has been adjusted such that all rules and their `onbuild` wrapped counterparts are inlined into the fold, before that the fold between the unwrapped and wrapped rules were both not inlined themselves. fixes: hadolint#798
Member
|
thanks, I really like this solution! Would you mind solving or silencing the hlint warnings? |
Member
|
I'll take care of the warnings |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
onbuildwrapper per-rule rather than on all rules combinedonbuildwrapper only for rules needing itonbuildwrapped counterpartsONBUILDstatementThe
onbuildwrapper makes sure a rule is also applied to the ASTbranch inside an
ONBUILDinstruction. But this is not necessary forall rules, for example rules dealing exclusively with
FROMinstructions need not be applied because that would be invalid syntax
anyways.
Moving the
onbuildwrapper to apply to each rule individually insteadof the fold of all rules permits granular control over which rules are
applied inside of an
ONBUILDinstruction and crucially also enablesthe ability to not apply rules on the AST branch inside of an
ONBUILDinstruction, if so desired.
In addition to that the inlining for the rules has been adjusted such
that all rules and their
onbuildwrapped counterparts are inlined intothe fold, before that the fold between the unwrapped and wrapped rules
were both not inlined themselves.
fixes: #798