|
| 1 | +linters-settings: |
| 2 | + exhaustive: |
| 3 | + default-signifies-exhaustive: true |
| 4 | + |
| 5 | + gocritic: |
| 6 | + # The list of supported checkers can be find in https://go-critic.github.io/overview. |
| 7 | + settings: |
| 8 | + underef: |
| 9 | + # Whether to skip (*x).method() calls where x is a pointer receiver. |
| 10 | + skipRecvDeref: false |
| 11 | + |
| 12 | + govet: |
| 13 | + enable-all: true |
| 14 | + disable: |
| 15 | + - fieldalignment # too strict |
| 16 | + - shadow # complains too much about shadowing errors. All research points to this being fine. |
| 17 | + |
| 18 | + nakedret: |
| 19 | + max-func-lines: 0 |
| 20 | + |
| 21 | + nolintlint: |
| 22 | + allow-no-explanation: [ forbidigo, tracecheck, gomnd, gochecknoinits, makezero ] |
| 23 | + require-explanation: true |
| 24 | + require-specific: true |
| 25 | + |
| 26 | + revive: |
| 27 | + ignore-generated-header: true |
| 28 | + severity: error |
| 29 | + rules: |
| 30 | + - name: atomic |
| 31 | + - name: line-length-limit |
| 32 | + arguments: [ 200 ] |
| 33 | + # These are functions that we use without checking the errors often. Most of these can't return an error even |
| 34 | + # though they implement an interface that can. |
| 35 | + - name: unhandled-error |
| 36 | + arguments: |
| 37 | + - fmt.Printf |
| 38 | + - fmt.Println |
| 39 | + - fmt.Fprintf |
| 40 | + - fmt.Fprintln |
| 41 | + - os.Stderr.Sync |
| 42 | + - sb.WriteString |
| 43 | + - buf.WriteString |
| 44 | + - hasher.Write |
| 45 | + - os.Setenv |
| 46 | + - os.RemoveAll |
| 47 | + - name: var-naming |
| 48 | + arguments: [["ID", "URL", "HTTP", "API"], []] |
| 49 | + |
| 50 | + tenv: |
| 51 | + all: true |
| 52 | + |
| 53 | + varcheck: |
| 54 | + exported-fields: false # this appears to improperly detect exported variables as unused when they are used from a package with the same name |
| 55 | + |
| 56 | + |
| 57 | +linters: |
| 58 | + disable-all: true |
| 59 | + enable: |
| 60 | + - deadcode # Finds unused code |
| 61 | + - errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases |
| 62 | + - gosimple # Linter for Go source code that specializes in simplifying a code |
| 63 | + - govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string |
| 64 | + - ineffassign # Detects when assignments to existing variables are not used |
| 65 | + - staticcheck # Staticcheck is a go vet on steroids, applying a ton of static analysis checks |
| 66 | + - typecheck # Like the front-end of a Go compiler, parses and type-checks Go code |
| 67 | + - unused # Checks Go code for unused constants, variables, functions and types |
| 68 | + - varcheck # Finds unused global variables and constants |
| 69 | + - asasalint # Check for pass []any as any in variadic func(...any) |
| 70 | + - asciicheck # Simple linter to check that your code does not contain non-ASCII identifiers |
| 71 | + - bidichk # Checks for dangerous unicode character sequences |
| 72 | + - bodyclose # checks whether HTTP response body is closed successfully |
| 73 | + - durationcheck # check for two durations multiplied together |
| 74 | + - errorlint # errorlint is a linter for that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13. |
| 75 | + - execinquery # execinquery is a linter about query string checker in Query function which reads your Go src files and warning it finds |
| 76 | + - exhaustive # check exhaustiveness of enum switch statements |
| 77 | + - exportloopref # checks for pointers to enclosing loop variables |
| 78 | + - forbidigo # Forbids identifiers |
| 79 | + - gochecknoinits # Checks that no init functions are present in Go code |
| 80 | + - goconst # Finds repeated strings that could be replaced by a constant |
| 81 | + - gocritic # Provides diagnostics that check for bugs, performance and style issues. |
| 82 | + - godot # Check if comments end in a period |
| 83 | + - goimports # In addition to fixing imports, goimports also formats your code in the same style as gofmt. |
| 84 | + - gomoddirectives # Manage the use of 'replace', 'retract', and 'excludes' directives in go.mod. |
| 85 | + - goprintffuncname # Checks that printf-like functions are named with f at the end |
| 86 | + - gosec # Inspects source code for security problems |
| 87 | + - nakedret # Finds naked returns in functions greater than a specified function length |
| 88 | + - nilerr # Finds the code that returns nil even if it checks that the error is not nil. |
| 89 | + - noctx # noctx finds sending http request without context.Context |
| 90 | + - nolintlint # Reports ill-formed or insufficient nolint directives |
| 91 | + - nonamedreturns # Reports all named returns |
| 92 | + - nosprintfhostport # Checks for misuse of Sprintf to construct a host with port in a URL. |
| 93 | + - predeclared # find code that shadows one of Go's predeclared identifiers |
| 94 | + - revive # Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint. |
| 95 | + - tenv # tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17 |
| 96 | + - tparallel # tparallel detects inappropriate usage of t.Parallel() method in your Go test codes |
| 97 | + - unconvert # Remove unnecessary type conversions |
| 98 | + - usestdlibvars # detect the possibility to use variables/constants from the Go standard library |
| 99 | + - whitespace # Tool for detection of leading and trailing whitespace |
| 100 | + |
| 101 | +issues: |
| 102 | + max-same-issues: 50 |
| 103 | + |
| 104 | + exclude-rules: |
| 105 | + # Don't require TODO comments to end in a period |
| 106 | + - source: "(TODO)" |
| 107 | + linters: [ godot ] |
0 commit comments