New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: skip validation for children #161
Conversation
Have you verified that this fixes the issue? If not can you provide some steps I can follow in order to do so? Thanks! |
@@ -13,24 +12,19 @@ func Test_ExecuteCommand(t *testing.T) { | |||
// default config can also be overrided | |||
ruleCfg := ValidatorConfig{ | |||
ValidatorOptions: ValidatorOptions{ | |||
SkipCommands: map[string]bool{"cmd100 cmd0 subcmd01": true}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just removed from test
yep verified myself.
ValidatorOptions: ValidatorOptions{
SkipChildren: map[string]bool{
"root echo": true,
},
} this will stop checking root echo and root echo .... children |
is this breaking change also removes other flags that we have documented? Best to put more info into PR. I would like if we can avoid having multiple flags for skipping Skip for children can be done by
Where last lets start with docs and api description |
not a breaking change actually!
got it. this looks cool and is easy to use. Let's do this.
you telling about skipping issue or the whole project in general |
No. I meant that I will not review PRs without docs or description |
oh okay, if you haven't noticed, this was not a breaking change and docs was already there : https://github.com/aerogear/charmil/blob/validator-skip/docs/src/validator.md#ignore-commands but now let's do the proposed change and will update the docs. |
Really good. Do we have tests cases matching docs? (outside this PR) |
yep, we have a test using SkipCommands attribute |
validator/rules/executor.go
Outdated
@@ -70,6 +72,14 @@ func executeRecursive(cmd *cobra.Command, info *validator.StatusLog, ruleConfig | |||
|
|||
// executeRulesChildren execute rules on children of cmd | |||
func executeRulesChildren(cmd *cobra.Command, info *validator.StatusLog, ruleConfig *RuleConfig, userValidatorConfig *ValidatorConfig) []validator.ValidationError { | |||
|
|||
// if command's children needs to be ignored | |||
if val, ok := userValidatorConfig.ValidatorOptions.SkipCommands[cmd.CommandPath()+"*"]; ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be helper method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Docs first please next time. |
d7e16b1
to
6f2563c
Compare
6f2563c
to
9b9559a
Compare
yess 💪 |
We can release now |
Closes #151
Description
Type of change