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:
0x524a
2025-12-02 23:35:28 -05:00
parent db641b0864
commit c528c65761
+73 -71
View File
@@ -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:
locale: US misspell:
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 dupl from ONVIF API files - similar patterns are expected
- path: (media|device|ptz|imaging|device_security|device_additional)\.go
linters:
- dupl
# Exclude dupl from cmd directories
- path: cmd/
linters:
- dupl
# Exclude known false positives max-issues-per-linter: 50
- text: "Error return value of .((os\\.)?std(out|err)\\..*|.*Close|.*Flush|.*Write|.*Read|.*Printf?|.*Fprintf?) is not checked" max-same-issues: 10
linters:
- errcheck
# Exclude dupl from ONVIF API files - similar patterns are expected
- path: (media|device|ptz|imaging|device_security|device_additional)\.go
linters:
- dupl
# Exclude dupl from cmd directories
- path: cmd/
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