db-migrator.go
/
.golangci.yml
220 строк · 11.0 Кб
1# $ golangci-lint run --config=~/.golangci.yml ./... > lint.txt
2
3run:
4# timeout for analysis, e.g. 30s, 5m, default is 1m
5timeout: 7m
6
7# exit code when at least one issue was found, default is 1
8issues-exit-code: 1
9
10# include test files or not, default is true
11tests: false
12
13# list of build tags, all linters use it. Default is empty list.
14# build-tags:
15# - mytag
16
17# which dirs to skip: issues from them won't be reported;
18# can use regexp here: generated.*, regexp is applied on full path;
19# default value is empty list, but default dirs are skipped independently
20# from this option's value (see skip-dirs-use-default).
21# "/" will be replaced by current OS file path separator to properly work
22# on Windows.
23skip-dirs:
24- doc
25- docker
26
27# default is true. Enables skipping of directories:
28# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
29skip-dirs-use-default: true
30
31# which files to skip: they will be analyzed, but issues from them
32# won't be reported. Default value is empty list, but there is
33# no need to include all autogenerated files, we confidently recognize
34# autogenerated files. If it's not please let us know.
35# "/" will be replaced by current OS file path separator to properly work
36# on Windows.
37skip-files:
38- \.pb\.go$
39- \.pb\.gw\.go$
40
41# - ".*\\.my\\.go$"
42# - lib/bad.go
43
44# by default isn't set. If set we pass it to "go list -mod={option}". From "go help modules":
45# If invoked with -mod=readonly, the go command is disallowed from the implicit
46# automatic updating of go.mod described above. Instead, it fails when any changes
47# to go.mod are needed. This setting is most useful to check that go.mod does
48# not need updates, such as in a continuous integration and testing system.
49# If invoked with -mod=vendor, the go command assumes that the vendor
50# directory holds the correct copies of dependencies and ignores
51# the dependency descriptions in go.mod.
52# modules-download-mode: readonly|vendor|mod
53
54# Allow multiple parallel golangci-lint instances running.
55# If false (default) - golangci-lint acquires file lock on start.
56allow-parallel-runners: true
57
58linters:
59enable:
60# Enabled by default linters:
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 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 # 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.
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
69# Disabled by default linters:
70- bodyclose # checks whether HTTP response body is closed successfully
71- durationcheck # : check for two durations multiplied together [fast: false, auto-fix: false]
72- 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.
73- errname # Checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error.
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- exportloopref # checks for pointers to enclosing loop variables
76- forcetypeassert # finds forced type assertions
77- goconst # Finds repeated strings that could be replaced by a constant
78- gocritic # Provides diagnostics that check for bugs, performance and style issues.
79- goimports # In addition to fixing imports, goimports also formats your code in the same style as gofmt.
80- goerr113 # Golang linter to check the errors handling expressions
81- gomnd # An analyzer to detect magic numbers.
82- gosec # Inspects source code for security problems
83- ireturn # Accept Interfaces, Return Concrete Types
84- importas # Enforces consistent import aliases
85- makezero # Finds slice declarations with non-zero initial length
86- nakedret # Finds naked returns in functions greater than a specified function length
87- nestif # Reports deeply nested if statements
88- nilerr # Finds the code that returns nil even if it checks that the error is not nil.
89- nolintlint # Reports ill-formed or insufficient nolint directives
90- prealloc # Finds slice declarations that could potentially be pre-allocated
91- predeclared # find code that shadows one of Go's predeclared identifiers
92- promlinter # Check Prometheus metrics naming via promlint
93- revive # Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint.
94- stylecheck # Stylecheck is a replacement for golint
95- misspell # Finds commonly misspelled English words in comments
96- unparam # Reports unused function parameters
97- unconvert # Remove unnecessary type conversions
98- whitespace # Tool for detection of leading and trailing whitespace
99disable:
100- godot # Check if comments end in a period
101- asasalint # check for pass []any as any in variadic func(...any)
102- asciicheck # Simple linter to check that your code does not contain non-ASCII identifiers
103- bidichk # Checks for dangerous unicode character sequences
104- containedctx # containedctx is a linter that detects struct contained context.Context field
105- contextcheck # check the function whether use a non-inherited context
106- cyclop # checks function and package cyclomatic complexity
107- decorder # check declaration order and count of types, constants, variables and functions
108- depguard # Go linter that checks if package imports are in a list of acceptable packages
109- dogsled # Checks assignments with too many blank identifiers (e.g. x, , , _, := f())
110- execinquery # execinquery is a linter about query string checker in Query function which reads your Go src files and warning it finds
111- exhaustive # check exhaustiveness of enum switch statements
112- exhaustruct # Checks if all structure fields are initialized
113- forbidigo # Forbids identifiers
114- funlen # Tool for detection of long functions
115- gci # Gci controls golang package import order and makes it always deterministic.
116- gochecknoglobals # check that no global variables exist
117- gochecknoinits # Checks that no init functions are present in Go code
118- gocognit # Computes and checks the cognitive complexity of functions
119- gocyclo # Computes and checks the cyclomatic complexity of functions
120- godox # Tool for detection of FIXME, TODO and other comment keywords
121- goheader # Checks is file header matches to pattern
122- gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification
123- gofumpt # Gofumpt checks whether code was gofumpt-ed.
124- gomoddirectives # Manage the use of 'replace', 'retract', and 'excludes' directives in go.mod.
125- 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.
126- goprintffuncname # Checks that printf-like functions are named with f at the end
127- grouper # An analyzer to analyze expression groups.
128- interfacebloat # A linter that checks the number of methods inside an interface.
129- lll # Reports long lines
130- maintidx # maintidx measures the maintainability index of each function.
131- nilnil # Checks that there is no simultaneous return of nil error and an invalid value.
132- nlreturn # nlreturn checks for a new line before return and branch statements to increase code clarity
133- noctx # noctx finds sending http request without context.Context
134- nonamedreturns # Reports all named returns
135- nosprintfhostport # Checks for misuse of Sprintf to construct a host with port in a URL.
136- paralleltest # paralleltest detects missing usage of t.Parallel() method in your Go test
137- reassign # Checks that package variables are not reassigned
138- rowserrcheck # checks whether Err of rows is checked successfully
139- sqlclosecheck # Checks that sql.Rows and sql.Stmt are closed.
140- tagliatelle # Checks the struct tags.
141- tenv # tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17
142- testpackage # linter that makes you use a separate _test package
143- thelper # thelper detects golang test helpers without t.Helper() call and checks the consistency of test helpers
144- tparallel # tparallel detects inappropriate usage of t.Parallel() method in your Go test codes
145- usestdlibvars # A linter that detect the possibility to use variables/constants from the Go standard library.
146- varnamelen # checks that the length of a variable's name matches its scope
147- wastedassign # wastedassign finds wasted assignment statements.
148- wrapcheck # Checks that errors returned from external packages are wrapped
149- wsl # Whitespace Linter - Forces you to use empty lines!
150
151output:
152# colored-line-number|line-number|json|tab|checkstyle|code-climate|junit-xml|github-actions
153# default is "colored-line-number"
154format: colored-line-number
155
156# print lines of code with issue, default is true
157print-issued-lines: false
158
159# print linter name in the end of issue text, default is true
160print-linter-name: true
161
162# make issues output unique by line, default is true
163# uniq-by-line: true
164
165# add a prefix to the output file references; default is no prefix
166# path-prefix: ""
167
168# sorts results by: filepath, line and column
169sort-results: false
170
171# all available settings of specific linters
172linters-settings:
173govet:
174check-shadowing: true
175
176golint:
177min-confidence: 0
178
179dupl:
180threshold: 100
181
182goconst:
183min-len: 2
184min-occurrences: 2
185
186errcheck:
187exclude-functions:
188- io/ioutil.ReadFile
189- io.Copy(*bytes.Buffer)
190- io.Copy(os.Stdout)
191- (io.ReadCloser).Close
192
193gocritic:
194# Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint run` to see all tags and checks.
195# Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags".
196disabled-checks:
197- importShadow
198- emptyStringTest
199enabled-tags:
200- diagnostic
201- experimental
202- opinionated
203- performance
204- style
205
206revive:
207rules:
208- name: package-comments
209severity: warning
210disabled: true
211
212issues:
213exclude-use-default: true
214exclude-rules:
215- linters:
216- govet
217text: "declaration of \"err\" shadows declaration"
218- linters:
219- goerr113
220text: "do not define dynamic errors, use wrapped static errors instead"
221