Skip to content
Closed
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
200 changes: 123 additions & 77 deletions backend/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,12 @@ run:
timeout: 5m
issues-exit-code: 1
tests: true
skip-dirs:
- vendor/
- .git/
- tmp/
skip-files:
- ".*\\.pb\\.go$"
- ".*\\.gen\\.go$"

output:
format: colored-line-number
formats:
- format: colored-line-number
print-issued-lines: true
print-linter-name: true
uniq-by-line: true
path-prefix: ""
sort-results: true

Expand Down Expand Up @@ -76,9 +69,9 @@ linters-settings:
line-length: 120
tab-width: 4

# Cognitive complexity
# Cognitive complexity (increased from 20 to 30 for temporary relief)
gocognit:
min-complexity: 20
min-complexity: 30

# Interface pollution
interfacebloat:
Expand Down Expand Up @@ -147,9 +140,9 @@ linters-settings:
unnamedResult:
checkExported: true

# Nesting depth
# Nesting depth (increased from 4 to 6 for temporary relief)
nestif:
min-complexity: 4
min-complexity: 6

# Nil checks
nilnil:
Expand Down Expand Up @@ -233,112 +226,128 @@ linters-settings:

linters:
enable:
# Enabled by default
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- typecheck
- unused

# Additional linters
# Critical - Enabled by default (compilation and correctness)
- errcheck # Error checking
- gosimple # Code simplification
- govet # Go vet tool
- ineffassign # Detect ineffectual assignments
- staticcheck # Advanced static analysis
- typecheck # Type checking
- unused # Unused code detection

# Security - Keep these enabled
- gosec # Security analysis
- bodyclose # HTTP body close checks
- contextcheck # Context usage validation
- sqlclosecheck # SQL statement close checks

# Performance - Keep important ones
- copyloopvar # Loop variable reference issues (replacement for exportloopref)
- makezero # Slice initialization
- prealloc # Slice preallocation
- unconvert # Unnecessary type conversions

# Logic and Bugs - Keep critical ones
- durationcheck # Duration usage
- errname # Error naming
- errorlint # Error wrapping
- nilerr # Nil error returns
- nilnil # Nil pointer returns
- reassign # Variable reassignment
- rowserrcheck # SQL row error checking

# Moderate complexity checks (keep reasonable limits)
- gocognit # Cognitive complexity (but with higher limits)
- interfacebloat # Interface size limits
- nestif # Nesting depth

# Basic formatting (keep simple ones)
- gofmt # Go formatting
- goimports # Import formatting
- misspell # Spelling errors

disable:
# Temporarily disable problematic style linters
- godot # Comment punctuation (too strict)
- wsl # Whitespace linting (too strict)
- nlreturn # New line returns (too strict)
- varnamelen # Variable name length (too strict)
- goheader # File header requirements (too strict)

# Disable other strict style linters
- cyclop # Cyclomatic complexity (too strict)
- funlen # Function length (too strict)
- gocyclo # Cyclomatic complexity (too strict)
- gocritic # Various style checks (too many complaints)
- lll # Line length (too strict)
- revive # Style checks (too strict)
- stylecheck # Style checks (too strict)
- whitespace # Whitespace (too strict)
- wrapcheck # Error wrapping (too strict)

# Disable other problematic linters
- asasalint
- asciicheck
- bidichk
- bodyclose
- containedctx
- contextcheck
- cyclop
- decorder
- dogsled
- dupl
- dupl # Duplicate code (too strict)
- dupword
- durationcheck
- errname
- errorlint
- execinquery
- exhaustive
- exportloopref
- forbidigo
- forcetypeassert
- funlen
- gci
- ginkgolinter
- gocheckcompilerdirectives
- gochecknoglobals
- gochecknoinits
- gocognit
- goconst
- gocritic
- gocyclo
- godot
- godox
- gofmt
- gofumpt
- goheader
- goimports
- gomnd
- mnd # Magic numbers (too strict)
- gomoddirectives
- gomodguard
- goprintffuncname
- gosec
- grouper
- importas
- interfacebloat
- lll
- loggercheck
- makezero
- mirror
- misspell
- nakedret
- nestif
- nilerr
- nilnil
- nlreturn
- noctx
- nolintlint
- nonamedreturns
- nosprintfhostport
- prealloc
- predeclared
- promlinter
- reassign
- revive
- rowserrcheck
- sqlclosecheck
- stylecheck
- tagliatelle
- tenv
- testableexamples
- thelper
- tparallel
- unconvert
- unparam
- usestdlibvars
- varnamelen
- wastedassign
- whitespace
- wrapcheck
- wsl

disable:
- depguard # We manage dependencies appropriately
- exhaustivestruct # Too restrictive
- exhaustruct # Too restrictive

# Deprecated or not needed
- depguard # We manage dependencies appropriately
- exhaustruct # Too restrictive
- gochecksumtype # Not needed for this project
- goerr113 # Too restrictive for this project
- golint # Deprecated
- interfacer # Deprecated
- maligned # Deprecated
- nosnakecase # We use snake_case for JSON/DB tags
- paralleltest # Not all tests need to be parallel
- scopelint # Deprecated
- testpackage # Not required for this project
- err113 # Too restrictive for this project (renamed from goerr113)
- paralleltest # Not all tests need to be parallel
- testpackage # Not required for this project
- godox # TODO comments (not critical)

issues:
exclude-files:
- ".*\\.pb\\.go$"
- ".*\\.gen\\.go$"
exclude-dirs:
- vendor/
- .git/
- tmp/
uniq-by-line: true
exclude-rules:
# Exclude some linters from running on tests files.
# Exclude many linters from running on test files
- path: _test\.go
linters:
- gocyclo
Expand All @@ -348,11 +357,33 @@ issues:
- funlen
- gocognit
- lll
- nestif
- interfacebloat
- govet
- staticcheck
- prealloc
- makezero
- unconvert
- durationcheck
- errname
- errorlint
- nilerr
- nilnil
- reassign
- rowserrcheck
- bodyclose
- contextcheck
- sqlclosecheck

# Exclude some staticcheck messages
- linters:
- staticcheck
text: "SA9003:"

# Exclude common staticcheck false positives
- linters:
- staticcheck
text: "SA1019:" # Deprecated functions (sometimes unavoidable)

# Exclude lll issues for long lines with go:generate
- linters:
Expand All @@ -362,11 +393,26 @@ issues:
# Exclude security issues in test files
- path: _test\.go
text: "G404:" # Use of weak random number generator

# Exclude more security issues that are acceptable in tests
- path: _test\.go
text: "G101:" # Hardcoded credentials (test data)

- path: _test\.go
text: "G204:" # Command execution (test helpers)

# Exclude magic number issues in tests and main files
- path: "(main|_test)\\.go"
linters:
- gomnd
- mnd

# Exclude some issues in main.go (initialization code)
- path: "main\\.go"
linters:
- gocognit
- nestif
- interfacebloat
- contextcheck

exclude-use-default: false
max-issues-per-linter: 0
Expand Down
Binary file modified backend/app
Binary file not shown.
Loading
Loading