Skip to content

build(deps): bump gitlab.com/bosi/decorder from 0.2.3 to 0.4.0 #3959

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

Merged
merged 1 commit into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .golangci.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ linters-settings:
- var
- func

# If true, underscore vars (vars with "_" as the name) will be ignored at all checks
# Default: false (underscore vars are not ignored)
ignore-underscore-vars: false

# If true, order of declarations is not checked at all.
# Default: true (disabled)
disable-dec-order-check: false
Expand All @@ -170,6 +174,18 @@ linters-settings:
# Default: true (disabled)
disable-dec-num-check: false

# If true, type declarations will be ignored for dec num check
# Default: false (type statements are not ignored)
disable-type-dec-num-check: false

# If true, const declarations will be ignored for dec num check
# Default: false (const statements are not ignored)
disable-const-dec-num-check: false

# If true, var declarations will be ignored for dec num check
# Default: false (var statements are not ignored)
disable-var-dec-num-check: false

depguard:
# Rules to apply.
#
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ require (
github.com/yagipy/maintidx v1.0.0
github.com/yeya24/promlinter v0.2.0
github.com/ykadowak/zerologlint v0.1.3
gitlab.com/bosi/decorder v0.2.3
gitlab.com/bosi/decorder v0.4.0
go.tmz.dev/musttag v0.7.1
golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea
golang.org/x/tools v0.11.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum

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

4 changes: 4 additions & 0 deletions pkg/config/linters_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,11 @@ type DepGuardDeny struct {

type DecorderSettings struct {
DecOrder []string `mapstructure:"dec-order"`
IgnoreUnderscoreVars bool `mapstructure:"ignore-underscore-vars"`
DisableDecNumCheck bool `mapstructure:"disable-dec-num-check"`
DisableTypeDecNumCheck bool `mapstructure:"disable-type-dec-num-check"`
DisableConstDecNumCheck bool `mapstructure:"disable-const-dec-num-check"`
DisableVarDecNumCheck bool `mapstructure:"disable-var-dec-num-check"`
DisableDecOrderCheck bool `mapstructure:"disable-dec-order-check"`
DisableInitFuncFirstCheck bool `mapstructure:"disable-init-func-first-check"`
}
Expand Down
8 changes: 8 additions & 0 deletions pkg/golinters/decorder.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,22 @@ func NewDecorder(settings *config.DecorderSettings) *goanalysis.Linter {

// disable all rules/checks by default
cfg := map[string]any{
"ignore-underscore-vars": false,
"disable-dec-num-check": true,
"disable-type-dec-num-check": false,
"disable-const-dec-num-check": false,
"disable-var-dec-num-check": false,
"disable-dec-order-check": true,
"disable-init-func-first-check": true,
}

if settings != nil {
cfg["dec-order"] = strings.Join(settings.DecOrder, ",")
cfg["ignore-underscore-vars"] = settings.IgnoreUnderscoreVars
cfg["disable-dec-num-check"] = settings.DisableDecNumCheck
cfg["disable-type-dec-num-check"] = settings.DisableTypeDecNumCheck
cfg["disable-const-dec-num-check"] = settings.DisableConstDecNumCheck
cfg["disable-var-dec-num-check"] = settings.DisableVarDecNumCheck
cfg["disable-dec-order-check"] = settings.DisableDecOrderCheck
cfg["disable-init-func-first-check"] = settings.DisableInitFuncFirstCheck
}
Expand Down