github.com/MetalBlockchain/metalgo@v1.11.9/.golangci.yml (about) 1 # https://golangci-lint.run/usage/configuration/ 2 run: 3 timeout: 10m 4 5 # If set we pass it to "go list -mod={option}". From "go help modules": 6 # If invoked with -mod=readonly, the go command is disallowed from the implicit 7 # automatic updating of go.mod described above. Instead, it fails when any changes 8 # to go.mod are needed. This setting is most useful to check that go.mod does 9 # not need updates, such as in a continuous integration and testing system. 10 # If invoked with -mod=vendor, the go command assumes that the vendor 11 # directory holds the correct copies of dependencies and ignores 12 # the dependency descriptions in go.mod. 13 # 14 # Allowed values: readonly|vendor|mod 15 # By default, it isn't set. 16 modules-download-mode: readonly 17 18 output: 19 # Make issues output unique by line. 20 # Default: true 21 uniq-by-line: false 22 23 issues: 24 # Maximum issues count per one linter. 25 # Set to 0 to disable. 26 # Default: 50 27 max-issues-per-linter: 0 28 29 # Maximum count of issues with the same text. 30 # Set to 0 to disable. 31 # Default: 3 32 max-same-issues: 0 33 34 # Enables skipping of directories: 35 # - vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ 36 # Default: true 37 exclude-dirs-use-default: false 38 39 linters: 40 disable-all: true 41 enable: 42 - asciicheck 43 - bodyclose 44 - depguard 45 - dupword 46 - errcheck 47 - errorlint 48 - exportloopref 49 - forbidigo 50 - gci 51 - goconst 52 - gocritic 53 # - goerr113 54 - gofmt 55 - gofumpt 56 # - gomnd 57 - goprintffuncname 58 - gosec 59 - gosimple 60 - govet 61 - importas 62 - ineffassign 63 # - lll 64 - misspell 65 - nakedret 66 - noctx 67 - nolintlint 68 - perfsprint 69 - prealloc 70 - predeclared 71 - revive 72 - spancheck 73 - staticcheck 74 - stylecheck 75 - tagalign 76 - testifylint 77 - typecheck 78 - unconvert 79 - unparam 80 - unused 81 - usestdlibvars 82 - whitespace 83 84 linters-settings: 85 depguard: 86 rules: 87 packages: 88 deny: 89 - pkg: "container/list" 90 desc: github.com/ava-labs/avalanchego/utils/linked should be used instead. 91 - pkg: "github.com/golang/mock/gomock" 92 desc: go.uber.org/mock/gomock should be used instead. 93 - pkg: "github.com/stretchr/testify/assert" 94 desc: github.com/stretchr/testify/require should be used instead. 95 - pkg: "io/ioutil" 96 desc: io/ioutil is deprecated. Use package io or os instead. 97 errorlint: 98 # Check for plain type assertions and type switches. 99 asserts: false 100 # Check for plain error comparisons. 101 comparison: false 102 forbidigo: 103 # Forbid the following identifiers (list of regexp). 104 forbid: 105 - 'require\.Error$(# ErrorIs should be used instead)?' 106 - 'require\.ErrorContains$(# ErrorIs should be used instead)?' 107 - 'require\.EqualValues$(# Equal should be used instead)?' 108 - 'require\.NotEqualValues$(# NotEqual should be used instead)?' 109 - '^(t|b|tb|f)\.(Fatal|Fatalf|Error|Errorf)$(# the require library should be used instead)?' 110 # Exclude godoc examples from forbidigo checks. 111 exclude_godoc_examples: false 112 gci: 113 sections: 114 - standard 115 - default 116 - blank 117 - dot 118 - prefix(github.com/ava-labs/avalanchego) 119 - alias 120 skip-generated: true 121 custom-order: true 122 gosec: 123 excludes: 124 - G107 # Url provided to HTTP request as taint input https://securego.io/docs/rules/g107 125 importas: 126 # Do not allow unaliased imports of aliased packages. 127 no-unaliased: false 128 # Do not allow non-required aliases. 129 no-extra-aliases: false 130 # List of aliases 131 alias: 132 - pkg: github.com/ava-labs/avalanchego/utils/math 133 alias: safemath 134 - pkg: github.com/ava-labs/avalanchego/utils/json 135 alias: avajson 136 revive: 137 rules: 138 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#bool-literal-in-expr 139 - name: bool-literal-in-expr 140 disabled: false 141 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#early-return 142 - name: early-return 143 disabled: false 144 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#empty-lines 145 - name: empty-lines 146 disabled: false 147 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#string-format 148 - name: string-format 149 disabled: false 150 arguments: 151 - ["b.Logf[0]", "/.*%.*/", "no format directive, use b.Log instead"] 152 - ["fmt.Errorf[0]", "/.*%.*/", "no format directive, use errors.New instead"] 153 - ["fmt.Fprintf[1]", "/.*%.*/", "no format directive, use fmt.Fprint instead"] 154 - ["fmt.Printf[0]", "/.*%.*/", "no format directive, use fmt.Print instead"] 155 - ["fmt.Sprintf[0]", "/.*%.*/", "no format directive, use fmt.Sprint instead"] 156 - ["log.Fatalf[0]", "/.*%.*/", "no format directive, use log.Fatal instead"] 157 - ["log.Printf[0]", "/.*%.*/", "no format directive, use log.Print instead"] 158 - ["t.Logf[0]", "/.*%.*/", "no format directive, use t.Log instead"] 159 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#struct-tag 160 - name: struct-tag 161 disabled: false 162 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unexported-naming 163 - name: unexported-naming 164 disabled: false 165 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unhandled-error 166 - name: unhandled-error 167 disabled: false 168 arguments: 169 - "fmt\\.Fprint" 170 - "fmt\\.Fprintf" 171 - "fmt\\.Fprintln" 172 - "fmt\\.Print" 173 - "fmt\\.Printf" 174 - "fmt\\.Println" 175 - "math/rand\\.Read" 176 - "strings\\.Builder\\.WriteString" 177 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-parameter 178 - name: unused-parameter 179 disabled: false 180 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-receiver 181 - name: unused-receiver 182 disabled: false 183 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#useless-break 184 - name: useless-break 185 disabled: false 186 spancheck: 187 # https://github.com/jjti/go-spancheck#checks 188 checks: 189 - end 190 # - record-error # check that `span.RecordError(err)` is called when an error is returned 191 # - set-status # check that `span.SetStatus(codes.Error, msg)` is called when an error is returned 192 staticcheck: 193 # https://staticcheck.io/docs/options#checks 194 checks: 195 - "all" 196 - "-SA6002" # Storing non-pointer values in sync.Pool allocates memory 197 - "-SA1019" # Using a deprecated function, variable, constant or field 198 tagalign: 199 align: true 200 sort: true 201 strict: true 202 order: 203 - serialize 204 testifylint: 205 # Enable all checkers (https://github.com/Antonboom/testifylint#checkers). 206 # Default: false 207 enable-all: true 208 # Disable checkers by name 209 # (in addition to default 210 # suite-thelper 211 # ). 212 disable: 213 - go-require 214 - float-compare