| 1 | linters-settings: |
| 2 | govet: |
| 3 | check-shadowing: true |
| 4 | misspell: |
| 5 | locale: US |
| 6 | exhaustive: |
| 7 | default-signifies-exhaustive: true |
| 8 | gomodguard: |
| 9 | blocked: |
| 10 | modules: |
| 11 | - github.com/pkg/errors: |
| 12 | recommendations: |
| 13 | - errors |
| 14 | |
| 15 | linters: |
| 16 | enable: |
| 17 | - asciicheck # Simple linter to check that your code does not contain non-ASCII identifiers |
| 18 | - bidichk # Checks for dangerous unicode character sequences |
| 19 | - bodyclose # checks whether HTTP response body is closed successfully |
| 20 | - contextcheck # check the function whether use a non-inherited context |
| 21 | - decorder # check declaration order and count of types, constants, variables and functions |
| 22 | - depguard # Go linter that checks if package imports are in a list of acceptable packages |
| 23 | - dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f()) |
| 24 | - dupl # Tool for code clone detection |
| 25 | - durationcheck # check for two durations multiplied together |
| 26 | - errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases |
| 27 | - errchkjson # Checks types passed to the json encoding functions. Reports unsupported types and optionally reports occations, where the check for the returned error can be omitted. |
| 28 | - errname # Checks that sentinel errors are prefixed with the `Err` and error types are suffixed with the `Error`. |
| 29 | - 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. |
| 30 | - exhaustive # check exhaustiveness of enum switch statements |
| 31 | - exportloopref # checks for pointers to enclosing loop variables |
| 32 | - forcetypeassert # finds forced type assertions |
| 33 | - gci # Gci control golang package import order and make it always deterministic. |
| 34 | - gochecknoglobals # Checks that no globals are present in Go code |
| 35 | - gochecknoinits # Checks that no init functions are present in Go code |
| 36 | - gocognit # Computes and checks the cognitive complexity of functions |
| 37 | - goconst # Finds repeated strings that could be replaced by a constant |
| 38 | - gocritic # The most opinionated Go source code linter |
| 39 | - godox # Tool for detection of FIXME, TODO and other comment keywords |
| 40 | - goerr113 # Golang linter to check the errors handling expressions |
| 41 | - gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification |
| 42 | - gofumpt # Gofumpt checks whether code was gofumpt-ed. |
| 43 | - goheader # Checks is file header matches to pattern |
| 44 | - goimports # Goimports does everything that gofmt does. Additionally it checks unused imports |
| 45 | - gomoddirectives # Manage the use of 'replace', 'retract', and 'excludes' directives in go.mod. |
| 46 | - gomodguard # Allow and block list linter for direct Go module dependencies. This is different from depguard where there are different block types for example version constraints and module recommendations. |
| 47 | - goprintffuncname # Checks that printf-like functions are named with `f` at the end |
| 48 | - gosec # Inspects source code for security problems |
| 49 | - gosimple # Linter for Go source code that specializes in simplifying a code |
| 50 | - govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string |
| 51 | - grouper # An analyzer to analyze expression groups. |
| 52 | - importas # Enforces consistent import aliases |
| 53 | - ineffassign # Detects when assignments to existing variables are not used |
| 54 | - misspell # Finds commonly misspelled English words in comments |
| 55 | - nakedret # Finds naked returns in functions greater than a specified function length |
| 56 | - nilerr # Finds the code that returns nil even if it checks that the error is not nil. |
| 57 | - nilnil # Checks that there is no simultaneous return of `nil` error and an invalid value. |
| 58 | - noctx # noctx finds sending http request without context.Context |
| 59 | - predeclared # find code that shadows one of Go's predeclared identifiers |
| 60 | - revive # golint replacement, finds style mistakes |
| 61 | - staticcheck # Staticcheck is a go vet on steroids, applying a ton of static analysis checks |
| 62 | - stylecheck # Stylecheck is a replacement for golint |
| 63 | - tagliatelle # Checks the struct tags. |
| 64 | - tenv # tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17 |
| 65 | - tparallel # tparallel detects inappropriate usage of t.Parallel() method in your Go test codes |
| 66 | - typecheck # Like the front-end of a Go compiler, parses and type-checks Go code |
| 67 | - unconvert # Remove unnecessary type conversions |
| 68 | - unparam # Reports unused function parameters |
| 69 | - unused # Checks Go code for unused constants, variables, functions and types |
| 70 | - wastedassign # wastedassign finds wasted assignment statements |
| 71 | - whitespace # Tool for detection of leading and trailing whitespace |
| 72 | disable: |
| 73 | - containedctx # containedctx is a linter that detects struct contained context.Context field |
| 74 | - cyclop # checks function and package cyclomatic complexity |
| 75 | - exhaustivestruct # Checks if all struct's fields are initialized |
| 76 | - forbidigo # Forbids identifiers |
| 77 | - funlen # Tool for detection of long functions |
| 78 | - gocyclo # Computes and checks the cyclomatic complexity of functions |
| 79 | - godot # Check if comments end in a period |
| 80 | - gomnd # An analyzer to detect magic numbers. |
| 81 | - ifshort # Checks that your code uses short syntax for if-statements whenever possible |
| 82 | - ireturn # Accept Interfaces, Return Concrete Types |
| 83 | - lll # Reports long lines |
| 84 | - maintidx # maintidx measures the maintainability index of each function. |
| 85 | - makezero # Finds slice declarations with non-zero initial length |
| 86 | - maligned # Tool to detect Go structs that would take less memory if their fields were sorted |
| 87 | - nestif # Reports deeply nested if statements |
| 88 | - nlreturn # nlreturn checks for a new line before return and branch statements to increase code clarity |
| 89 | - nolintlint # Reports ill-formed or insufficient nolint directives |
| 90 | - paralleltest # paralleltest detects missing usage of t.Parallel() method in your Go test |
| 91 | - prealloc # Finds slice declarations that could potentially be preallocated |
| 92 | - promlinter # Check Prometheus metrics naming via promlint |
| 93 | - rowserrcheck # checks whether Err of rows is checked successfully |
| 94 | - sqlclosecheck # Checks that sql.Rows and sql.Stmt are closed. |
| 95 | - testpackage # linter that makes you use a separate _test package |
| 96 | - thelper # thelper detects golang test helpers without t.Helper() call and checks the consistency of test helpers |
| 97 | - varnamelen # checks that the length of a variable's name matches its scope |
| 98 | - wrapcheck # Checks that errors returned from external packages are wrapped |
| 99 | - wsl # Whitespace Linter - Forces you to use empty lines! |
| 100 | |
| 101 | issues: |
| 102 | exclude-use-default: false |
| 103 | exclude-rules: |
| 104 | # Allow complex tests, better to be self contained |
| 105 | - path: _test\.go |
| 106 | linters: |
| 107 | - gocognit |
| 108 | |
| 109 | # Allow complex main function in examples |
| 110 | - path: examples |
| 111 | text: "of func `main` is high" |
| 112 | linters: |
| 113 | - gocognit |
| 114 | |
| 115 | run: |
| 116 | skip-dirs-use-default: false |