|
| 1 | +version: '2' |
| 2 | + |
| 3 | +run: |
| 4 | + timeout: 5m |
| 5 | + tests: true |
| 6 | + modules-download-mode: readonly |
| 7 | + |
| 8 | +linters: |
| 9 | + enable: |
| 10 | + - errcheck # Check for unchecked errors |
| 11 | + - govet # Standard Go vet checks |
| 12 | + - ineffassign # Detect ineffectual assignments |
| 13 | + - staticcheck # Advanced static analysis (includes gosimple) |
| 14 | + - unused # Check for unused code |
| 15 | + - misspell # Check spelling |
| 16 | + - gocritic # Comprehensive linter with many checks |
| 17 | + - revive # Fast, configurable, extensible linter |
| 18 | + - gosec # Security-focused linter |
| 19 | + - unconvert # Remove unnecessary type conversions |
| 20 | + - unparam # Find unused function parameters |
| 21 | + - bodyclose # Check HTTP response bodies are closed |
| 22 | + - noctx # Find http requests without context |
| 23 | + - sqlclosecheck # Check SQL rows/statements are closed |
| 24 | + - rowserrcheck # Check SQL rows errors are checked |
| 25 | + |
| 26 | + disable: |
| 27 | + - exhaustive # Can be too strict for switch statements |
| 28 | + - exhaustruct # Can be too strict for struct initialization |
| 29 | + - funlen # Function length check can be subjective |
| 30 | + - gochecknoglobals # Globals sometimes needed |
| 31 | + - gocyclo # Cyclomatic complexity can be subjective |
| 32 | + - godox # Allow TODO/FIXME comments |
| 33 | + - lll # Line length too strict |
| 34 | + - nestif # Nesting depth can be subjective |
| 35 | + - wsl # Whitespace linter too opinionated |
| 36 | + |
| 37 | + settings: |
| 38 | + govet: |
| 39 | + enable-all: true |
| 40 | + disable: |
| 41 | + - shadow |
| 42 | + - fieldalignment # Struct field ordering for memory optimization is too pedantic |
| 43 | + |
| 44 | + staticcheck: |
| 45 | + checks: ['all'] |
| 46 | + |
| 47 | + errcheck: |
| 48 | + check-type-assertions: true |
| 49 | + check-blank: true |
| 50 | + |
| 51 | + gosec: |
| 52 | + excludes: |
| 53 | + - G104 # Allow some unhandled errors where appropriate |
| 54 | + severity: medium |
| 55 | + |
| 56 | + gocritic: |
| 57 | + enabled-tags: |
| 58 | + - diagnostic |
| 59 | + - experimental |
| 60 | + - opinionated |
| 61 | + - performance |
| 62 | + - style |
| 63 | + disabled-checks: |
| 64 | + - captLocal |
| 65 | + |
| 66 | + revive: |
| 67 | + rules: |
| 68 | + - name: exported |
| 69 | + severity: warning |
| 70 | + - name: unexported-return |
| 71 | + severity: warning |
| 72 | + - name: var-naming |
| 73 | + severity: warning |
| 74 | + |
| 75 | + exclusions: |
| 76 | + rules: |
| 77 | + # Exclude some linters from running on tests files |
| 78 | + - path: _test\.go |
| 79 | + linters: |
| 80 | + - gosec |
| 81 | + - unparam |
| 82 | + |
| 83 | + # Exclude known linters from partially hard-vendored code |
| 84 | + - path: vendor/ |
| 85 | + linters: |
| 86 | + - all |
| 87 | + |
| 88 | + # Exclude shadow checking on short variable names |
| 89 | + - linters: |
| 90 | + - govet |
| 91 | + text: 'shadow: declaration of "(err|ctx)"' |
| 92 | + |
| 93 | + # Allow capitalized local variable names (SRP uses A, B, M1, M2 per RFC 5054) |
| 94 | + - linters: |
| 95 | + - gocritic |
| 96 | + text: 'captLocal:' |
| 97 | + |
| 98 | + # Internal compute functions have error returns for API consistency |
| 99 | + - linters: |
| 100 | + - unparam |
| 101 | + text: 'result 1 \(error\) is always nil' |
| 102 | + path: srp\.go |
| 103 | + |
| 104 | +issues: |
| 105 | + # Maximum issues count per one linter |
| 106 | + max-issues-per-linter: 0 |
| 107 | + |
| 108 | + # Maximum count of issues with the same text |
| 109 | + max-same-issues: 0 |
| 110 | + |
| 111 | + # Unique issues by line |
| 112 | + uniq-by-line: true |
| 113 | + |
| 114 | +output: |
| 115 | + formats: |
| 116 | + text: |
| 117 | + path: stdout |
| 118 | + print-linter-name: true |
| 119 | + print-issued-lines: true |
| 120 | + colors: true |
| 121 | + sort-order: |
| 122 | + - linter |
| 123 | + - file |
0 commit comments