-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.golangci.yaml
More file actions
93 lines (89 loc) · 4.97 KB
/
.golangci.yaml
File metadata and controls
93 lines (89 loc) · 4.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# yaml-language-server: $schema=https://golangci-lint.run/jsonschema/golangci.jsonschema.json
version: "2"
run:
build-tags: [ safe ]
modules-download-mode: readonly
linters:
default: all
disable:
# Project specific linters
- goconst
- paralleltest
# Discouraged linters
- noinlineerr # Disallows inline error handling (`if err := ...; err != nil {`).
- embeddedstructfieldcheck # Embedded types should be at the top of the field list of a struct, and there must be an empty line separating embedded fields from regular fields. [fast]
- cyclop # checks function and package cyclomatic complexity [fast: false, auto-fix: false]
- depguard # Go linter that checks if package imports are in a list of acceptable packages [fast: true, auto-fix: false]
- dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f()) [fast: true, auto-fix: false]
- dupl # Tool for code clone detection [fast: true, auto-fix: false]
- dupword # checks for duplicate words in the source code [fast: true, auto-fix: false]
- dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f()) [fast: true, auto-fix: false]
- err113 # Go linter to check the errors handling expressions [fast: false, auto-fix: false]
- exhaustruct # Checks if all structure fields are initialized [fast: false, auto-fix: false]
- funlen # Tool for detection of long functions [fast: true, auto-fix: false]
- ginkgolinter # enforces standards of using ginkgo and gomega [fast: false, auto-fix: false]
- gochecknoglobals # Check that no global variables exist. [fast: false, auto-fix: false]
- gochecknoinits # Checks that no init functions are present in Go code [fast: true, auto-fix: false]
- gocognit # Computes and checks the cognitive complexity of functions [fast: true, auto-fix: false]
- gocyclo # Computes and checks the cyclomatic complexity of functions [fast: true, auto-fix: false]
- godot # Check if comments end in a period [fast: true, auto-fix: true]
- godox # Tool for detection of comment keywords [fast: true, auto-fix: false]
- interfacebloat # A linter that checks the number of methods inside an interface. [fast: true, auto-fix: false]
- intrange # (go >= 1.22) intrange is a linter to find places where for loops could make use of an integer range. [fast: true, auto-fix: false]
- ireturn # Accept Interfaces, Return Concrete Types [fast: false, auto-fix: false]
- lll # Reports long lines [fast: true, auto-fix: false]
- maintidx # maintidx measures the maintainability index of each function. [fast: true, auto-fix: false]
- nestif # Reports deeply nested if statements [fast: true, auto-fix: false]
- nlreturn # nlreturn checks for a new line before return and branch statements to increase code clarity [fast: true, auto-fix: false]
- mnd # An analyzer to detect magic numbers. [fast: true, auto-fix: false]
- perfsprint # Checks that fmt.Sprintf can be replaced with a faster alternative. [fast: false, auto-fix: false]
- prealloc # Finds slice declarations that could potentially be pre-allocated [fast: true, auto-fix: false]
- protogetter # Reports direct reads from proto message fields when getters should be used [fast: false, auto-fix: true]
- sloglint # ensure consistent code style when using log/slog [fast: false, auto-fix: false]
- tagalign # check that struct tags are well aligned [fast: true, auto-fix: true]
- tagliatelle # Checks the struct tags. [fast: true, auto-fix: false]
- unparam # Reports unused function parameters [fast: false, auto-fix: false]
- varnamelen # checks that the length of a variable's name matches its scope [fast: false, auto-fix: false]
- wrapcheck # Checks that errors returned from external packages are wrapped [fast: false, auto-fix: false]
- zerologlint # Detects the wrong usage of `zerolog` that a user forgets to dispatch with `Send` or `Msg` [fast: false, auto-fix: false]
# Deprected linters
- wsl
# https://golangci-lint.run/docs/linters/
settings:
# https://golangci-lint.run/docs/linters/configuration/#exhaustive
exhaustive:
default-signifies-exhaustive: true
# https://golangci-lint.run/docs/linters/configuration/#gosec
gosec:
severity: medium
confidence: medium
# https://golangci-lint.run/docs/linters/configuration/#revive
revive:
rules:
- name: package-comments
disabled: true
# https://golangci-lint.run/docs/linters/configuration/#gomoddirectives
gomoddirectives:
replace-local: true
tool-forbidden: true
go-debug-forbidden: true
toolchain-forbidden: true
go-version-pattern: '\d\.\d+'
exclusions:
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- path: _test\.go
linters:
- forbidigo
paths:
- docs
- tmp
# https://golangci-lint.run/docs/formatters/
formatters:
enable:
- gofmt
- goimports