Skip to content

Commit

Permalink
Log when problems are hidden due to --min-severity flag
Browse files Browse the repository at this point in the history
  • Loading branch information
prymitive committed Feb 6, 2023
1 parent 722919c commit 3c3a620
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cmd/pint/lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,10 @@ func actionLint(c *cli.Context) error {
}

bySeverity := map[string]interface{}{} // interface{} is needed for log.Fields()
var problems int
var problems, hiddenProblems int
for s, c := range summary.CountBySeverity() {
if s < minSeverity {
hiddenProblems++
continue
}
bySeverity[s.String()] = c
Expand All @@ -93,6 +94,9 @@ func actionLint(c *cli.Context) error {
if problems > 0 {
return fmt.Errorf("problems found")
}
if hiddenProblems > 0 {
log.Info().Msgf("%d problem(s) not visible because of --%s=%s flag", hiddenProblems, minSeverityFlag, c.String(minSeverityFlag))
}

return nil
}
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0089_lint_min_severity_bug.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pint.ok --no-color lint --min-severity=bug rules
cmp stderr stderr.txt

-- stderr.txt --
level=info msg="1 problem(s) not visible because of --min-severity=bug flag"
-- rules/0001.yml --
groups:
- name: foo
Expand Down

0 comments on commit 3c3a620

Please sign in to comment.