Skip to content

Commit

Permalink
Update wsl to 3.3.0, sort config in example config (#1922)
Browse files Browse the repository at this point in the history
* Update wsl to 3.3.0, sort config in example config
* chore: ignore CVE-2020-26160
  • Loading branch information
bombsimon committed Apr 21, 2021
1 parent 9cb902c commit d6bcf9f
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 16 deletions.
23 changes: 8 additions & 15 deletions .golangci.example.yml
Expand Up @@ -518,26 +518,19 @@ linters-settings:
multi-func: false # Enforces newlines (or comments) after every multi-line function signature

wsl:
# If true append is only allowed to be cuddled if appending value is
# matching variables, fields or types on line above. Default is true.
strict-append: true
# Allow calls and assignments to be cuddled as long as the lines have any
# matching variables, fields or types. Default is true.
allow-assign-and-call: true
# Allow assignments to be cuddled with anything. Default is false.
# See https://github.com/bombsimon/wsl/blob/master/doc/configuration.md for
# documentation of available settings. These are the defaults for
# `golangci-lint`.
allow-assign-and-anything: false
# Allow multiline assignments to be cuddled. Default is true.
allow-multiline-assign: true
# Allow declarations (var) to be cuddled.
allow-assign-and-call: true
allow-cuddle-declarations: false
# Allow trailing comments in ending of blocks
allow-multiline-assign: true
allow-separated-leading-comment: false
allow-trailing-comment: false
# Force newlines in end of case at this limit (0 = never).
force-case-trailing-whitespace: 0
# Force cuddling of err checks with err var assignment
force-err-cuddling: false
# Allow leading comments to be separated with empty lines
allow-separated-leading-comment: false
force-short-decl-cuddling: false
strict-append: true

# The custom section can be used to define linter plugins to be loaded at runtime. See README doc
# for more info.
Expand Down
3 changes: 3 additions & 0 deletions .nancy-ignore
Expand Up @@ -5,3 +5,6 @@ CVE-2020-15136

# Skip for indirect dependency github.com/gogo/protobuf@1.3.1
CVE-2021-3121

# Skip for indirect dependency github.com/dgrijalva/jwt-go@3.2.0
CVE-2020-26160
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -11,7 +11,7 @@ require (
github.com/ashanbrown/forbidigo v1.1.0
github.com/ashanbrown/makezero v0.0.0-20210308000810-4155955488a0
github.com/bkielbasa/cyclop v1.2.0
github.com/bombsimon/wsl/v3 v3.2.0
github.com/bombsimon/wsl/v3 v3.3.0
github.com/charithe/durationcheck v0.0.6
github.com/daixiang0/gci v0.2.8
github.com/denis-tingajkin/go-header v0.4.2
Expand Down
3 changes: 3 additions & 0 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pkg/config/config.go
Expand Up @@ -360,6 +360,7 @@ type WSLSettings struct {
AllowTrailingComment bool `mapstructure:"allow-trailing-comment"`
AllowSeparatedLeadingComment bool `mapstructure:"allow-separated-leading-comment"`
ForceCuddleErrCheckAndAssign bool `mapstructure:"force-err-cuddling"`
ForceExclusiveShortDeclarations bool `mapstructure:"force-short-decl-cuddling"`
ForceCaseTrailingWhitespaceLimit int `mapstructure:"force-case-trailing-whitespace"`
}

Expand Down Expand Up @@ -523,6 +524,7 @@ var defaultLintersSettings = LintersSettings{
AllowTrailingComment: false,
AllowSeparatedLeadingComment: false,
ForceCuddleErrCheckAndAssign: false,
ForceExclusiveShortDeclarations: false,
ForceCaseTrailingWhitespaceLimit: 0,
},
NoLintLint: NoLintLintSettings{
Expand Down
1 change: 1 addition & 0 deletions pkg/golinters/wsl.go
Expand Up @@ -46,6 +46,7 @@ func NewWSL() *goanalysis.Linter {
AllowSeparatedLeadingComment: linterCfg.AllowSeparatedLeadingComment,
ForceCuddleErrCheckAndAssign: linterCfg.ForceCuddleErrCheckAndAssign,
ForceCaseTrailingWhitespaceLimit: linterCfg.ForceCaseTrailingWhitespaceLimit,
ForceExclusiveShortDeclarations: linterCfg.ForceExclusiveShortDeclarations,
AllowCuddleWithCalls: []string{"Lock", "RLock"},
AllowCuddleWithRHS: []string{"Unlock", "RUnlock"},
ErrorVariableNames: []string{"err"},
Expand Down

0 comments on commit d6bcf9f

Please sign in to comment.