|
| 1 | +# TO BE REMOVED IN https://jira.mongodb.org/browse/CLOUDP-308470 |
| 2 | + |
| 3 | +linters-settings: |
| 4 | + gocritic: |
| 5 | + enabled-tags: |
| 6 | + - diagnostic |
| 7 | + - experimental |
| 8 | + - opinionated |
| 9 | + - performance |
| 10 | + - style |
| 11 | + govet: |
| 12 | + enable: |
| 13 | + - shadow |
| 14 | + |
| 15 | + revive: |
| 16 | + # see https://github.com/mgechev/revive#available-rules for details. |
| 17 | + ignore-generated-header: true |
| 18 | + severity: warning |
| 19 | + rules: |
| 20 | + - name: blank-imports |
| 21 | + - name: context-as-argument |
| 22 | + - name: context-keys-type |
| 23 | + - name: defer |
| 24 | + - name: dot-imports |
| 25 | + - name: error-return |
| 26 | + - name: error-strings |
| 27 | + - name: error-naming |
| 28 | + - name: early-return |
| 29 | + - name: errorf |
| 30 | + - name: exported |
| 31 | + - name: import-shadowing |
| 32 | + - name: indent-error-flow |
| 33 | + - name: if-return |
| 34 | + - name: increment-decrement |
| 35 | + - name: var-naming |
| 36 | + - name: var-declaration |
| 37 | + - name: package-comments |
| 38 | + - name: range |
| 39 | + - name: receiver-naming |
| 40 | + - name: time-naming |
| 41 | + - name: unexported-return |
| 42 | + - name: indent-error-flow |
| 43 | + - name: errorf |
| 44 | + - name: empty-block |
| 45 | + - name: superfluous-else |
| 46 | + - name: struct-tag |
| 47 | + - name: unused-parameter |
| 48 | + - name: unreachable-code |
| 49 | + - name: redefines-builtin-id |
| 50 | + - name: unused-receiver |
| 51 | + - name: constant-logical-expr |
| 52 | + - name: confusing-naming |
| 53 | + - name: unnecessary-stmt |
| 54 | + - name: use-any |
| 55 | + - name: imports-blocklist |
| 56 | + arguments: |
| 57 | + - "github.com/pkg/errors" |
| 58 | + misspell: |
| 59 | + locale: US |
| 60 | + lll: |
| 61 | + line-length: 150 |
| 62 | + nestif: |
| 63 | + # minimal complexity of if statements to report, 5 by default |
| 64 | + min-complexity: 7 |
| 65 | + funlen: |
| 66 | + lines: 360 |
| 67 | + statements: 120 |
| 68 | + gci: |
| 69 | + sections: |
| 70 | + - standard |
| 71 | + - default |
| 72 | +linters: |
| 73 | + disable-all: true |
| 74 | + enable: |
| 75 | + - copyloopvar # copyloopvar is a linter detects places where loop variables are copied |
| 76 | + - dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f()) |
| 77 | + - errcheck # errcheck is a program for checking for unchecked errors in Go code. These unchecked errors can be critical bugs in some cases |
| 78 | + - errorlint # Errorlint is a linter that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13. |
| 79 | + - exhaustive # check exhaustiveness of enum switch statements |
| 80 | + - copyloopvar # copyloopvar is a linter detects places where loop variables are copied. Replaces exportloopref since Go1.22 |
| 81 | + - funlen # Tool for detection of long functions |
| 82 | + - gci # Gci controls golang package import order and makes it always deterministic. [fast: true, auto-fix: false] |
| 83 | + - gocritic # Provides diagnostics that check for bugs, performance and style issues. |
| 84 | + - godot # Check if comments end in a period [fast: true, auto-fix: true] |
| 85 | + - gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification |
| 86 | + - goimports # Check import statements are formatted according to the 'goimport' command. Reformat imports in autofix mode. |
| 87 | + - goprintffuncname # Checks that printf-like functions are named with `f` at the end. |
| 88 | + - gosec # Inspects source code for security problems |
| 89 | + - gosimple # Linter for Go source code that specializes in simplifying code |
| 90 | + - govet # Vet examines Go source code and reports suspicious constructs. It is roughly the same as 'go vet' and uses its passes. |
| 91 | + - ineffassign # Detects when assignments to existing variables are not used |
| 92 | + - lll # Reports long lines |
| 93 | + - makezero # Finds slice declarations with non-zero initial length |
| 94 | + - misspell # Finds commonly misspelled English words |
| 95 | + - nakedret # Checks that functions with naked returns are not longer than a maximum size (can be zero). |
| 96 | + - noctx # Finds sending http request without context.Context |
| 97 | + - nolintlint # Reports ill-formed or insufficient nolint directives |
| 98 | + - perfsprint # Checks that fmt.Sprintf can be replaced with a faster alternative. |
| 99 | + - prealloc # Finds slice declarations that could potentially be pre-allocated |
| 100 | + - predeclared # find code that shadows one of Go's predeclared identifiers |
| 101 | + - revive # Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint. |
| 102 | + - rowserrcheck # checks whether Rows.Err of rows is checked successfully |
| 103 | + - staticcheck # It's a set of rules from staticcheck. It's not the same thing as the staticcheck binary. The author of staticcheck doesn't support or approve the use of staticcheck as a library inside golangci-lint. |
| 104 | + - stylecheck # Stylecheck is a replacement for golint |
| 105 | + - tenv # tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17 |
| 106 | + - testifylint # Checks usage of github.com/stretchr/testify. |
| 107 | + - thelper # thelper detects tests helpers which is not start with t.Helper() method. |
| 108 | + - unconvert # Remove unnecessary type conversions |
| 109 | + - unused # Checks Go code for unused constants, variables, functions and types |
| 110 | + - whitespace # Whitespace is a linter that checks for unnecessary newlines at the start and end of functions, if, for, etc. |
| 111 | + |
| 112 | + # don't enable: |
| 113 | + # - deadcode |
| 114 | + # - varcheck |
| 115 | + # - structcheck |
| 116 | + # - depguard # Go linter that checks if package imports are in a list of acceptable packages [fast: true, auto-fix: false] |
| 117 | + # - gocyclo # we already have funlen lint |
| 118 | + # - dupl # we have a lot of duplicate test cases |
| 119 | + # - gochecknoinits # we need the init function for the provider |
| 120 | + # - gochecknoglobals # we need some global variables |
| 121 | + # - unparam # Forces to create global variables when one variable is repeated in different functions |
| 122 | + # - goerr113 # It does not allow you to return an error, you need to save the error in a variable to do it |
| 123 | + # - goconst |
| 124 | + # - gocognit |
| 125 | + |
| 126 | +run: |
| 127 | + timeout: 10m |
| 128 | + tests: true |
| 129 | + modules-download-mode: readonly |
0 commit comments