Skip to content

Commit

Permalink
ci: adjust lint
Browse files Browse the repository at this point in the history
Signed-off-by: thxCode <[email protected]>
  • Loading branch information
thxCode committed Feb 4, 2024
1 parent 4ebaab4 commit aee90aa
Show file tree
Hide file tree
Showing 9 changed files with 132 additions and 269 deletions.
115 changes: 64 additions & 51 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ linters:
- exportloopref
- godot
- goconst
- gofumpt
- gocritic
- gosimple
- gosec
- govet
- gofumpt
- gofmt
- ineffassign
- lll
- makezero
- misspell
- misspell
- nakedret
- nilerr
- prealloc
Expand All @@ -75,24 +75,20 @@ linters:
# - funlen

linters-settings:
staticcheck:
checks: ["all", "-SA1019", "-SA2002"]
stylecheck:
checks: ["all", "-ST1003"]
gosec:
severity: "low"
confidence: "low"
excludes:
- G101
- G107
- G112
- G404
revive:
rules:
- name: var-naming
disabled: true
arguments:
- ["HTTP", "ID", "TLS", "TCP", "UDP", "API", "CA", "URL", "DNS"]
decorder:
dec-order:
- const
- var
- func
disable-init-func-first-check: false
disable-dec-order-check: true
errorlint:
# Check whether fmt.Errorf uses the %w verb for formatting errors. See the readme for caveats
errorf: true
# Check for plain type assertions and type switches
asserts: true
# Check for plain error comparisons
comparison: true
godot:
# Comments to be checked: `declarations`, `toplevel`, or `all`.
# Default: declarations
Expand All @@ -110,24 +106,65 @@ linters-settings:
# Check that each sentence starts with a capital letter.
# Default: false
capital: true
lll:
# max line length, lines longer will be reported. Default is 120.
# '\t' is counted as 1 character by default, and can be changed with the tab-width option
line-length: 150
# tab width in spaces. Default to 1.
tab-width: 1
goconst:
# Minimal length of string constant.
# Default: 3
min-len: 3
# Minimum occurrences of constant string count to trigger issue.
# Default: 3
min-occurrences: 3
min-occurrences: 10
gosimple:
go: "1.21"
checks: [ "all" ]
gosec:
severity: "low"
confidence: "low"
excludes:
- G101
- G107
- G112
- G404
gofumpt:
# Choose whether to use the extra rules.
# Default: false
extra-rules: true
gofmt:
# Simplify code: gofmt with `-s` option.
# Default: true
simplify: true
# Apply the rewrite rules to the source before reformatting.
# https://pkg.go.dev/cmd/gofmt
# Default: []
rewrite-rules:
- pattern: 'interface{}'
replacement: 'any'
- pattern: 'a[b:len(a)]'
replacement: 'a[b:]'
lll:
# max line length, lines longer will be reported. Default is 120.
# '\t' is counted as 1 character by default, and can be changed with the tab-width option
line-length: 150
# tab width in spaces. Default to 1.
tab-width: 1
makezero:
always: false
misspell:
# Correct spellings using locale preferences for US or UK.
# Default is to use a neutral variety of English.
# Setting locale to US will correct the British spelling of 'colour' to 'color'.
locale: US
nakedret:
max-func-lines: 60
revive:
rules:
- name: var-naming
disabled: true
arguments:
- [ "HTTP", "ID", "TLS", "TCP", "UDP", "API", "CA", "URL", "DNS" ]
staticcheck:
checks: [ "all", "-SA1019", "-SA2002", "-SA5008" ]
stylecheck:
checks: [ "all", "-ST1003" ]
unparam:
# Inspect exported functions, default is false. Set to true if no external program/library imports your code.
# XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
Expand Down Expand Up @@ -156,20 +193,6 @@ linters-settings:
# Mark all identifiers inside generated files as used.
# Default: true
generated-is-used: true
errorlint:
# Check whether fmt.Errorf uses the %w verb for formatting errors. See the readme for caveats
errorf: true
# Check for plain type assertions and type switches
asserts: true
# Check for plain error comparisons
comparison: true
makezero:
always: false
gosimple:
go: "1.20"
checks: ["all"]
nakedret:
max-func-lines: 60
usestdlibvars:
# Suggest the use of http.MethodXX
# Default: true
Expand All @@ -189,22 +212,12 @@ linters-settings:
# Suggest the use of crypto.Hash
# Default: false
crypto-hash: true
decorder:
dec-order:
- const
- var
- func
disable-init-func-first-check: false
disable-dec-order-check: true

issues:
exclude-rules:
- path: _test\.go
linters:
- errcheck
- gosec
- rowserrcheck
- makezero
- lll
- funlen
- wsl
Loading

0 comments on commit aee90aa

Please sign in to comment.