Skip to content

Commit

Permalink
merge two last commits for rerun tests
Browse files Browse the repository at this point in the history
  • Loading branch information
peakle committed Mar 28, 2022
1 parent ae90e61 commit 5dd6baf
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions checkers/ruleguard_checker.go
Expand Up @@ -161,17 +161,9 @@ func newRuleguardChecker(info *linter.CheckerInfo, ctx *linter.CheckerContext) (
}
ruleguardDebug := os.Getenv("GOCRITIC_RULEGUARD_DEBUG") != ""

inDisabledByTags := func(g *ruleguard.GoRuleGroup) bool {
inTags := func(g *ruleguard.GoRuleGroup, tags map[string]bool) bool {
for _, t := range g.DocTags {
if disabledTags[t] {
return true
}
}
return false
}
inEnabledByTags := func(g *ruleguard.GoRuleGroup) bool {
for _, t := range g.DocTags {
if enabledTags[t] {
if tags[t] {
return true
}
}
Expand All @@ -190,9 +182,9 @@ func newRuleguardChecker(info *linter.CheckerInfo, ctx *linter.CheckerContext) (
whyDisabled = "not enabled by -enabled flag"
case disabledGroups[g.Name]:
whyDisabled = "disabled by -disable flag"
case len(enabledTags) != 0 && !inEnabledByTags(g):
case len(enabledTags) != 0 && !inTags(g, enabledTags):
whyDisabled = "not enabled by tags in -enable flag"
case len(disabledTags) != 0 && inDisabledByTags(g):
case len(disabledTags) != 0 && inTags(g, disabledTags):
whyDisabled = "disabled by tags in -disable flag"
}
if ruleguardDebug {
Expand Down

0 comments on commit 5dd6baf

Please sign in to comment.