github.com/zchee/zap-cloudlogging@v0.0.0-20220819025602-19b026d3900e/.golangci.yaml (about) 1 # https://golangci-lint.run/usage/configuration/ 2 # https://github.com/golangci/golangci-lint/blob/master/pkg/config/linters_settings.go 3 --- 4 run: 5 timeout: 1m 6 issues-exit-code: 1 7 tests: true 8 build-tags: [] 9 skip-dirs: [] 10 skip-dirs-use-default: true 11 skip-files: [] 12 allow-parallel-runners: true 13 go: '1.19' 14 15 output: 16 format: colored-line-number 17 print-issued-lines: true 18 print-linter-name: true 19 uniq-by-line: false 20 sort-results: true 21 22 linters: 23 fast: false 24 disable-all: true 25 disabled: 26 - exhaustive # check exhaustiveness of enum switch statements 27 - exhaustruct # Checks if all structure fields are initialized 28 - forbidigo # Forbids identifiers 29 - forcetypeassert # finds forced type assertions 30 - gci # Gci controls golang package import order and makes it always deterministic 31 - gochecknoglobals # check that no global variables exist 32 - gochecknoinits # Checks that no init functions are present in Go code 33 - godox # Tool for detection of FIXME, TODO and other comment keywords 34 - goerr113 # Golang linter to check the errors handling expressions 35 - goheader # Checks is file header matches to pattern 36 - gomnd # An analyzer to detect magic numbers 37 - gomoddirectives # Manage the use of 'replace', 'retract', and 'excludes' directives in go.mod 38 - ireturn # Accept Interfaces, Return Concrete Types 39 - nlreturn # nlreturn checks for a new line before return and branch statements to increase code clarity 40 - nonamedreturns # Reports all named returns 41 - nosnakecase # nosnakecase is a linter that detects snake case of variable naming and function name 42 - testpackage # linter that makes you use a separate _test package 43 - wsl # Whitespace Linter 44 45 - exhaustivestruct # Deprecated: Checks if all struct's fields are initialized 46 - golint # Deprecated: Golint differs from gofmt. Gofmt reformats Go source code, whereas golint prints out style mistakes 47 - ifshort # Deprecated: Checks that your code uses short syntax for if-statements whenever possible 48 - interfacer # Deprecated: Linter that suggests narrower interface types 49 - maligned # Deprecated: Tool to detect Go structs that would take less memory if their fields were sorted 50 - scopelint # Deprecated: Scopelint checks for unpinned variables in go programs 51 enable: 52 - asasalint # check for pass []any as any in variadic func(...any) 53 - asciicheck # Simple linter to check that your code does not contain non-ASCII identifiers 54 - bidichk # Checks for dangerous unicode character sequences 55 - bodyclose # checks whether HTTP response body is closed successfully 56 - containedctx # containedctx is a linter that detects struct contained context.Context field 57 - contextcheck # check the function whether use a non-inherited context 58 - cyclop # checks function and package cyclomatic complexity 59 - deadcode # Finds unused code 60 - decorder # check declaration order and count of types, constants, variables and functions 61 - depguard # Go linter that checks if package imports are in a list of acceptable packages 62 - dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f()) 63 - dupl # Tool for code clone detection 64 - durationcheck # check for two durations multiplied together 65 - errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases 66 - errchkjson # Checks types passed to the json encoding functions. Reports unsupported types and optionally reports occasions, where the check for the returned error can be omitted 67 - errname # Checks that sentinel errors are prefixed with the `Err` and error types are suffixed with the `Error` 68 - 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 69 - execinquery # execinquery is a linter about query string checker in Query function which reads your Go src files and warning it finds 70 - exportloopref # checks for pointers to enclosing loop variables 71 - funlen # Tool for detection of long functions 72 - gocognit # Computes and checks the cognitive complexity of functions 73 - goconst # Finds repeated strings that could be replaced by a constant 74 - gocritic # Provides diagnostics that check for bugs, performance and style issues 75 - gocyclo # Computes and checks the cyclomatic complexity of functions 76 - godot # Check if comments end in a period 77 - gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification 78 - gofumpt # Gofumpt checks whether code was gofumpt-ed 79 - goimports # In addition to fixing imports, goimports also formats your code in the same style as gofmt 80 - 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 81 - goprintffuncname # Checks that printf-like functions are named with `f` at the end 82 - gosec # Inspects source code for security problems 83 - gosimple # Linter for Go source code that specializes in simplifying code 84 - govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string 85 - grouper # An analyzer to analyze expression groups 86 - importas # Enforces consistent import aliases 87 - ineffassign # Detects when assignments to existing variables are not used 88 - lll # Reports long lines 89 - maintidx # maintidx measures the maintainability index of each function 90 - makezero # Finds slice declarations with non-zero initial length 91 - misspell # Finds commonly misspelled English words in comments 92 - nakedret # Finds naked returns in functions greater than a specified function length 93 - nestif # Reports deeply nested if statements 94 - nilerr # Finds the code that returns nil even if it checks that the error is not nil 95 - nilnil # Checks that there is no simultaneous return of `nil` error and an invalid value 96 - noctx # noctx finds sending http request without context.Context 97 - nolintlint # Reports ill-formed or insufficient nolint directives 98 - nosprintfhostport # Checks for misuse of Sprintf to construct a host with port in a URL 99 - paralleltest # paralleltest detects missing usage of t.Parallel() method in your Go test 100 - prealloc # Finds slice declarations that could potentially be pre-allocated 101 - predeclared # find code that shadows one of Go's predeclared identifiers 102 - promlinter # Check Prometheus metrics naming via promlint 103 - revive # Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint 104 - rowserrcheck # checks whether Err of rows is checked successfully 105 - sqlclosecheck # Checks that sql.Rows and sql.Stmt are closed 106 - 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 107 - structcheck # Finds unused struct fields 108 - stylecheck # Stylecheck is a replacement for golint 109 - tagliatelle # Checks the struct tags 110 - tenv # tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17 111 - thelper # thelper detects golang test helpers without t.Helper() call and checks the consistency of test helpers 112 - tparallel # tparallel detects inappropriate usage of t.Parallel() method in your Go test codes 113 - typecheck # Like the front-end of a Go compiler, parses and type-checks Go code 114 - unconvert # Remove unnecessary type conversions 115 - unparam # Reports unused function parameters 116 - unused # Checks Go code for unused constants, variables, functions and types 117 - varcheck # Finds unused global variables and constants 118 - varnamelen # checks that the length of a variable's name matches its scope 119 - wastedassign # wastedassign finds wasted assignment statements 120 - whitespace # Tool for detection of leading and trailing whitespace 121 - wrapcheck # Checks that errors returned from external packages are wrapped 122 123 linters-settings: 124 asasalint: 125 exclude: [] 126 use-builtin-exclusions: true 127 ignore-test: false 128 cyclop: 129 # max-complexity: 130 # package-average: 131 skip-tests: true 132 depguard: 133 list-type: denylist 134 include-go-root: false 135 dupl: 136 threshold: 150 137 errcheck: 138 disable-default-exclusions: false 139 check-type-assertions: true 140 check-blank: true 141 ignore: "" 142 # exclude: .errcheckignore 143 exclude-functions: [] 144 145 # TODO(zchee): start re-implements point 146 errorlint: 147 errorf: true 148 asserts: true 149 comparison: true 150 funlen: 151 lines: 100 152 statements: 60 153 gocognit: 154 min-complexity: 30 155 goconst: 156 min-len: 3 157 min-occurrences: 3 158 gocritic: 159 enabled-tags: 160 - diagnostic 161 - experimental 162 - opinionated 163 - performance 164 - style 165 disabled-checks: 166 - commentedOutCode 167 - whyNoLint 168 settings: 169 hugeParam: 170 sizeThreshold: 80 171 rangeExprCopy: 172 sizeThreshold: 512 173 rangeValCopy: 174 sizeThreshold: 128 175 gocyclo: 176 min-complexity: 30 177 godot: 178 scope: declarations 179 capital: false 180 gofmt: 181 simplify: true 182 gofumpt: 183 extra-rules: true 184 goimports: 185 local-prefixes: github.com/zchee/zap-cloudlogging 186 govet: 187 enable-all: true 188 check-shadowing: true 189 importas: 190 alias: [] 191 no-unaliased: true 192 lll: 193 line-length: 200 194 tab-width: 1 195 misspell: 196 locale: US 197 nakedret: 198 max-func-lines: 30 199 nestif: 200 min-complexity: 4 201 prealloc: 202 simple: true 203 range-loops: true 204 for-loops: true 205 testpackage: 206 skip-regexp: '.*(export)_test\.go' 207 unparam: 208 check-exported: true 209 algo: cha 210 varnamelen: 211 max-distance: 5 212 min-name-length: 1 213 check-receiver: true 214 check-return: true 215 ignore-type-assert-ok: false 216 ignore-map-index-ok: false 217 ignore-chan-recv-ok: false 218 whitespace: 219 multi-if: true 220 multi-func: true 221 222 issues: 223 max-issues-per-linter: 0 224 max-same-issues: 0 225 exclude-use-default: true 226 exclude-rules: 227 - path: _test\.go 228 linters: 229 - errcheck 230 - funlen 231 - gocognit 232 - goconst 233 - gocyclo 234 - gosec 235 - lll 236 - wrapcheck 237 - path: "(.*)?_example_test.go" 238 linters: 239 - gocritic 240 # Exclude shadow checking on the variable named err 241 - text: "shadow: declaration of \"err|ok\"" 242 linters: 243 - govet 244 - text: "continue with no blank line before" 245 linters: 246 - nlreturn 247 # for implemenst zapcore.Core.Check interface 248 - text: entry is heavy \(\d* bytes\); consider passing it by pointer 249 path: cloudlogging.go 250 linters: 251 - gocritic 252 # for implemenst zapcore.Core.Write interface 253 - text: ent is heavy \(\d* bytes\); consider passing it by pointer 254 path: cloudlogging.go 255 linters: 256 - gocritic 257 # ignore error when a level is higher than zapcore.ErrorLevel 258 - text: Error return value of `c.Sync` is not checked 259 path: cloudlogging.go 260 linters: 261 - errcheck 262 # ObjectMarshaler return directly 263 - text: go.uber.org/zap/zapcore.ObjectMarshaler 264 linters: 265 - wrapcheck 266 - text: io.Copy 267 linters: 268 - errcheck 269 - path: pkg/monitoredresource/monitoredresource.go 270 linters: 271 - lll 272 - text: MarshalLogObject - result 0 \(error\) is always nil 273 linters: 274 - unparam 275 - path: symtab.go 276 linters: 277 - govet 278 - revive 279 - unused