Skip to content

Commit

Permalink
checkers: split ruleguard.failOnError into 2 params (#1133)
Browse files Browse the repository at this point in the history
* `failOn` is a new-style param that configures the error handling behavior

* `failOnError` remains an old-style param of bool type

`failOnError=true`  = `failOn='all'`
`failOnError=false` = `failOn=''`

See golangci/golangci-lint#2041 (comment)
  • Loading branch information
quasilyte committed Oct 19, 2021
1 parent 9bdaa90 commit 78f672b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion checkers/ruleguard_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ func init() {
Usage: "enable debug for the specified named rules group",
},
"failOnError": {
Value: false,
Usage: "deprecated, use failOn param; if set to true, identical to failOn='all', otherwise failOn=''",
},
"failOn": {
Value: "",
Usage: `Determines the behavior when an error occurs while parsing ruleguard files.
If flag is not set, log error and skip rule files that contain an error.
Expand Down Expand Up @@ -104,7 +108,13 @@ func newRuleguardChecker(info *linter.CheckerInfo, ctx *linter.CheckerContext) (
if rulesFlag == "" {
return c, nil
}
h, err := newErrorHandler(info.Params.String("failOnError"))
failOn := info.Params.String("failOn")
if failOn == "" {
if info.Params.Bool("failOnError") {
failOn = "all"
}
}
h, err := newErrorHandler(failOn)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 78f672b

Please sign in to comment.