|
| 1 | +# golangci-lint configuration for nix-auth |
| 2 | +# Documentation: https://golangci-lint.run/usage/configuration/ |
| 3 | + |
| 4 | +version: "2" |
| 5 | + |
| 6 | +run: |
| 7 | + # Timeout for analysis |
| 8 | + timeout: 5m |
| 9 | + |
| 10 | + # Include test files |
| 11 | + tests: true |
| 12 | + |
| 13 | + # List of build tags to use |
| 14 | + build-tags: |
| 15 | + - integration |
| 16 | + |
| 17 | +linters: |
| 18 | + default: standard |
| 19 | + enable: |
| 20 | + # Additional linters for code quality |
| 21 | + - bodyclose # Checks whether HTTP response body is closed successfully |
| 22 | + - dogsled # Checks assignments with too many blank identifiers |
| 23 | + - dupl # Tool for code clone detection |
| 24 | + - copyloopvar # Checks for unpinned variables in go programs |
| 25 | + - gocognit # Computes cognitive complexity of functions |
| 26 | + - goconst # Finds repeated strings that could be replaced by constants |
| 27 | + - gocritic # Provides diagnostics that check for bugs, performance and style issues |
| 28 | + - gocyclo # Computes cyclomatic complexity of functions |
| 29 | + - godot # Check if comments end in a period |
| 30 | + - mnd # Detects magic numbers (replaces gomnd) |
| 31 | + - goprintffuncname # Checks that printf-like functions are named with `f` at the end |
| 32 | + - gosec # Security checker |
| 33 | + - misspell # Finds commonly misspelled English words in comments |
| 34 | + - nakedret # Finds naked returns in functions greater than a specified function length |
| 35 | + - nestif # Reports deeply nested if statements |
| 36 | + - nilerr # Finds the code that returns nil even if it checks that the error is not nil |
| 37 | + - noctx # Finds sending http request without context.Context |
| 38 | + - nolintlint # Reports ill-formed or insufficient nolint directives |
| 39 | + - prealloc # Finds slice declarations that could potentially be preallocated |
| 40 | + - predeclared # Find code that shadows one of Go's predeclared identifiers |
| 41 | + - revive # Fast, configurable, extensible, flexible, and beautiful linter for Go |
| 42 | + - rowserrcheck # Checks whether Err of rows is checked successfully |
| 43 | + - sqlclosecheck # Checks that sql.Rows and sql.Stmt are closed |
| 44 | + - thelper # Detects Go test helpers without t.Helper() call |
| 45 | + - tparallel # Detects inappropriate usage of t.Parallel() method in your Go test codes |
| 46 | + - unconvert # Remove unnecessary type conversions |
| 47 | + - unparam # Reports unused function parameters |
| 48 | + - whitespace # Tool for detection of leading and trailing whitespace |
| 49 | + - wsl # Whitespace Linter |
| 50 | + |
| 51 | + disable: |
| 52 | + - depguard # Checks if package imports are in a list of acceptable packages |
| 53 | + - exhaustive # Check exhaustiveness of enum switch statements |
| 54 | + - funlen # Tool for detection of long functions |
| 55 | + - gochecknoglobals # Check that no global variables exist |
| 56 | + - godox # Tool for detection of FIXME, TODO and other comment keywords |
| 57 | + - err113 # Golang linter to check the errors handling expressions |
| 58 | + - wrapcheck # Checks that errors returned from external packages are wrapped |
| 59 | + |
| 60 | + exclusions: |
| 61 | + paths: |
| 62 | + - vendor |
| 63 | + - .git |
| 64 | + - testdata |
| 65 | + files: |
| 66 | + - ".*\\.pb\\.go$" |
| 67 | + - ".*\\.gen\\.go$" |
| 68 | + |
| 69 | +formatters: |
| 70 | + enable: |
| 71 | + - gci # Controls Go package import order and makes it deterministic |
| 72 | + - gofmt # Checks whether code was gofmt-ed |
| 73 | + - goimports # Check import statements are formatted according to the 'goimport' command |
| 74 | + |
| 75 | + exclusions: |
| 76 | + paths: |
| 77 | + - vendor |
| 78 | + - .git |
| 79 | + - testdata |
| 80 | + files: |
| 81 | + - ".*\\.pb\\.go$" |
| 82 | + - ".*\\.gen\\.go$" |
| 83 | + |
| 84 | +linters-settings: |
| 85 | + errcheck: |
| 86 | + # Don't report errors for defer Close() calls |
| 87 | + exclude-functions: |
| 88 | + - (io.Closer).Close |
| 89 | + - (*os.File).Close |
| 90 | + - (*io.PipeWriter).Close |
| 91 | + - (*bytes.Buffer).WriteTo |
| 92 | + - (*strings.Builder).WriteTo |
| 93 | + |
| 94 | + govet: |
| 95 | + # Enable all analyzers |
| 96 | + enable-all: true |
| 97 | + |
| 98 | + gocyclo: |
| 99 | + # Minimal code complexity to report |
| 100 | + min-complexity: 15 |
| 101 | + |
| 102 | + dupl: |
| 103 | + # Tokens count to trigger issue |
| 104 | + threshold: 100 |
| 105 | + |
| 106 | + goconst: |
| 107 | + # Minimal length of string constant |
| 108 | + min-len: 3 |
| 109 | + # Minimal occurrences count to trigger |
| 110 | + min-occurrences: 3 |
| 111 | + |
| 112 | + misspell: |
| 113 | + # Locale to use |
| 114 | + locale: US |
| 115 | + |
| 116 | + mnd: |
| 117 | + # Don't include the "operation" and "assign" |
| 118 | + checks: [argument,case,condition,return] |
| 119 | + |
| 120 | + gocritic: |
| 121 | + enabled-tags: |
| 122 | + - diagnostic |
| 123 | + - experimental |
| 124 | + - opinionated |
| 125 | + - performance |
| 126 | + - style |
| 127 | + disabled-checks: |
| 128 | + - dupImport # https://github.com/go-critic/go-critic/issues/845 |
| 129 | + - ifElseChain |
| 130 | + - octalLiteral |
| 131 | + - whyNoLint |
| 132 | + - wrapperFunc |
| 133 | + |
| 134 | + goimports: |
| 135 | + # Put local imports after 3rd-party packages |
| 136 | + local-prefixes: github.com/numtide/nix-auth |
| 137 | + |
| 138 | + gci: |
| 139 | + sections: |
| 140 | + - standard |
| 141 | + - default |
| 142 | + - prefix(github.com/numtide/nix-auth) |
| 143 | + |
| 144 | + nolintlint: |
| 145 | + # Enable to ensure that nolint directives are all used |
| 146 | + allow-unused: false |
| 147 | + # Exclude following linters from requiring an explanation |
| 148 | + allow-no-explanation: [] |
| 149 | + # Enable to require an explanation of nonzero length for nolint directives |
| 150 | + require-explanation: true |
| 151 | + # Enable to require nolint directives to mention the specific linter |
| 152 | + require-specific: true |
| 153 | + |
| 154 | + revive: |
| 155 | + # Accept interfaces, return concrete types |
| 156 | + confidence: 0.8 |
| 157 | + rules: |
| 158 | + - name: blank-imports |
| 159 | + - name: context-as-argument |
| 160 | + - name: context-keys-type |
| 161 | + - name: dot-imports |
| 162 | + - name: error-return |
| 163 | + - name: error-strings |
| 164 | + - name: error-naming |
| 165 | + - name: if-return |
| 166 | + - name: increment-decrement |
| 167 | + - name: var-naming |
| 168 | + - name: var-declaration |
| 169 | + - name: package-comments |
| 170 | + - name: range |
| 171 | + - name: receiver-naming |
| 172 | + - name: time-naming |
| 173 | + - name: unexported-return |
| 174 | + - name: indent-error-flow |
| 175 | + - name: errorf |
| 176 | + - name: empty-block |
| 177 | + - name: superfluous-else |
| 178 | + - name: unused-parameter |
| 179 | + - name: unreachable-code |
| 180 | + - name: redefines-builtin-id |
| 181 | + |
| 182 | +issues: |
| 183 | + # Exclude some linters from running on tests files |
| 184 | + exclude-rules: |
| 185 | + - path: _test\.go |
| 186 | + linters: |
| 187 | + - dupl |
| 188 | + - mnd |
| 189 | + # Exclude G104 (error handling) from specific files |
| 190 | + - linters: |
| 191 | + - gosec |
| 192 | + text: "G104" |
| 193 | + |
| 194 | + # Maximum issues count per one linter. Set to 0 to disable |
| 195 | + max-issues-per-linter: 0 |
| 196 | + |
| 197 | + # Maximum count of issues with the same text. Set to 0 to disable |
| 198 | + max-same-issues: 0 |
| 199 | + |
| 200 | + # Show only new issues created after git revision |
| 201 | + new: false |
| 202 | + |
| 203 | + # Fix found issues (if it's supported by the linter) |
| 204 | + fix: false |
| 205 | + |
| 206 | +severity: |
| 207 | + # Set the default severity for issues |
| 208 | + default: warning |
| 209 | + |
| 210 | + # The list of ids of default excludes to include or disable |
| 211 | + rules: |
| 212 | + - linters: |
| 213 | + - gosec |
| 214 | + text: "G104" # Errors unhandled |
| 215 | + severity: info |
0 commit comments