chore: update golangci-lint configuration for improved clarity and functionality
- Set default linters to none and reorganized settings for better structure. - Enhanced exclusion rules for specific linters in test files and ONVIF API files to reduce false positives. - Updated output formatting options for clearer linting results.
This commit is contained in:
+64
-62
@@ -5,6 +5,7 @@ run:
|
|||||||
tests: true
|
tests: true
|
||||||
|
|
||||||
linters:
|
linters:
|
||||||
|
default: none
|
||||||
enable:
|
enable:
|
||||||
- errcheck
|
- errcheck
|
||||||
- govet
|
- govet
|
||||||
@@ -44,78 +45,79 @@ linters:
|
|||||||
- tparallel
|
- tparallel
|
||||||
- wastedassign
|
- wastedassign
|
||||||
|
|
||||||
linters-settings:
|
settings:
|
||||||
errcheck:
|
errcheck:
|
||||||
check-type-assertions: true
|
check-type-assertions: true
|
||||||
check-blank: true
|
check-blank: true
|
||||||
|
|
||||||
gocyclo:
|
gocyclo:
|
||||||
min-complexity: 15
|
min-complexity: 15
|
||||||
|
|
||||||
funlen:
|
funlen:
|
||||||
lines: 120
|
lines: 120
|
||||||
statements: 60
|
statements: 60
|
||||||
|
|
||||||
gocritic:
|
gocritic:
|
||||||
enabled-tags:
|
enabled-tags:
|
||||||
- diagnostic
|
- diagnostic
|
||||||
- experimental
|
- experimental
|
||||||
- opinionated
|
- opinionated
|
||||||
- performance
|
- performance
|
||||||
- style
|
- style
|
||||||
disabled-checks:
|
disabled-checks:
|
||||||
- dupImport
|
- dupImport
|
||||||
- ifElseChain
|
- ifElseChain
|
||||||
- octalLiteral
|
- octalLiteral
|
||||||
- whyNoLint
|
- whyNoLint
|
||||||
- wrapperFunc
|
- wrapperFunc
|
||||||
|
|
||||||
gosec:
|
gosec:
|
||||||
severity: medium
|
severity: medium
|
||||||
confidence: medium
|
confidence: medium
|
||||||
|
|
||||||
godot:
|
godot:
|
||||||
scope: declarations
|
scope: declarations
|
||||||
exclude:
|
exclude:
|
||||||
- "^TODO:"
|
- "^TODO:"
|
||||||
- "^FIXME:"
|
- "^FIXME:"
|
||||||
|
|
||||||
goimports:
|
goimports:
|
||||||
local-prefixes: github.com/0x524a/onvif-go
|
local-prefixes:
|
||||||
|
- github.com/0x524a/onvif-go
|
||||||
|
|
||||||
misspell:
|
misspell:
|
||||||
locale: US
|
locale: US
|
||||||
|
|
||||||
issues:
|
exclusions:
|
||||||
exclude-rules:
|
generated: lax
|
||||||
# Exclude some linters from test files
|
presets:
|
||||||
- path: _test\.go
|
- comments
|
||||||
linters:
|
- std-error-handling
|
||||||
- errcheck
|
rules:
|
||||||
- gosec
|
# Exclude some linters from test files
|
||||||
- funlen
|
- path: _test\.go
|
||||||
- gocyclo
|
linters:
|
||||||
- gocognit
|
- errcheck
|
||||||
- dupl
|
- gosec
|
||||||
|
- funlen
|
||||||
|
- gocyclo
|
||||||
|
- gocognit
|
||||||
|
- dupl
|
||||||
|
|
||||||
# Exclude known false positives
|
# Exclude dupl from ONVIF API files - similar patterns are expected
|
||||||
- text: "Error return value of .((os\\.)?std(out|err)\\..*|.*Close|.*Flush|.*Write|.*Read|.*Printf?|.*Fprintf?) is not checked"
|
- path: (media|device|ptz|imaging|device_security|device_additional)\.go
|
||||||
linters:
|
linters:
|
||||||
- errcheck
|
- dupl
|
||||||
|
|
||||||
# Exclude dupl from ONVIF API files - similar patterns are expected
|
# Exclude dupl from cmd directories
|
||||||
- path: (media|device|ptz|imaging|device_security|device_additional)\.go
|
- path: cmd/
|
||||||
linters:
|
linters:
|
||||||
- dupl
|
- dupl
|
||||||
|
|
||||||
# Exclude dupl from cmd directories
|
max-issues-per-linter: 50
|
||||||
- path: cmd/
|
max-same-issues: 10
|
||||||
linters:
|
|
||||||
- dupl
|
|
||||||
|
|
||||||
max-issues-per-linter: 50
|
|
||||||
max-same-issues: 10
|
|
||||||
|
|
||||||
output:
|
output:
|
||||||
print-issued-lines: true
|
formats:
|
||||||
print-linter-name: true
|
text:
|
||||||
|
print-linter-name: true
|
||||||
|
|||||||
Reference in New Issue
Block a user