Skip to content

Commit af19ad3

Browse files
committed
update rules
1 parent 663ac6b commit af19ad3

File tree

3 files changed

+24
-15
lines changed

3 files changed

+24
-15
lines changed

.golangci.yml

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ linters-settings:
1111
gocyclo:
1212
min-complexity: 15
1313
govet:
14-
check-shadowing: true
14+
shadow: true
1515
maligned:
1616
suggest-new: true
1717
revive:
@@ -26,7 +26,9 @@ linters-settings:
2626
- name: error-return
2727
- name: error-strings
2828
- name: error-naming
29+
- name: errorf
2930
- name: exported
31+
- name: indent-error-flow
3032
- name: if-return
3133
- name: increment-decrement
3234
- name: var-naming
@@ -40,55 +42,58 @@ linters-settings:
4042
- name: errorf
4143
- name: empty-block
4244
- name: superfluous-else
45+
- name: struct-tag
4346
- name: unused-parameter
47+
- name: unused-receiver
4448
- name: unreachable-code
4549
- name: redefines-builtin-id
50+
tagliatelle:
51+
# check the struck tag name case
52+
case:
53+
use-field-name: true
54+
rules:
55+
json: camel
56+
yaml: camel
57+
4658
linters:
4759
# please, do not use `enable-all`: it's deprecated and will be removed soon.
4860
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
4961
disable-all: true
5062
enable:
5163
- bodyclose # checks whether HTTP response body is closed successfully [fast: false, auto-fix: false]
52-
- deadcode # Finds unused code [fast: false, auto-fix: false]
53-
- depguard # Go linter that checks if package imports are in a list of acceptable packages [fast: false, auto-fix: false]
5464
- dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f()) [fast: true, auto-fix: false]
5565
- errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases [fast: false, auto-fix: false]
5666
- 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. [fast: false, auto-fix: false]
5767
- exhaustive # check exhaustiveness of enum switch statements [fast: false, auto-fix: false]
58-
- exportloopref # checks for pointers to enclosing loop variables [fast: false, auto-fix: false]
5968
- gochecknoinits # Checks that no init functions are present in Go code [fast: true, auto-fix: false]
60-
- goconst # Finds repeated strings that could be replaced by a constant [fast: true, auto-fix: false]
6169
- gocritic # Provides many diagnostics that check for bugs, performance and style issues. [fast: false, auto-fix: false]
6270
- gocyclo # Computes and checks the cyclomatic complexity of functions [fast: true, auto-fix: false]
6371
- godot # Check if comments end in a period [fast: true, auto-fix: true]
6472
- gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification [fast: true, auto-fix: true]
6573
- goimports # Goimports does everything that gofmt does. Additionally it checks unused imports [fast: true, auto-fix: true]
66-
- gomnd # An analyzer to detect magic numbers. [fast: true, auto-fix: false]
6774
- goprintffuncname # Checks that printf-like functions are named with `f` at the end [fast: true, auto-fix: false]
6875
- gosec # Inspects source code for security problems [fast: false, auto-fix: false]
6976
- gosimple # Linter for Go source code that specializes in simplifying a code [fast: false, auto-fix: false]
7077
- govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string [fast: false, auto-fix: false]
71-
- ifshort # Checks that your code uses short syntax for if-statements whenever possible [fast: true, auto-fix: false]
7278
- ineffassign # Detects when assignments to existing variables are not used [fast: true, auto-fix: false]
7379
- misspell # Finds commonly misspelled English words in comments [fast: true, auto-fix: true]
7480
- nakedret # Finds naked returns in functions greater than a specified function length [fast: true, auto-fix: false]
7581
- nolintlint # Reports ill-formed or insufficient nolint directives [fast: true, auto-fix: false]
7682
- revive # Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint. [fast: false, auto-fix: false]
7783
- rowserrcheck # checks whether Err of rows is checked successfully [fast: false, auto-fix: false]
78-
- staticcheck #megacheck): Staticcheck is a go vet on steroids, applying a ton of static analysis checks [fast: false, auto-fix: false]
79-
- structcheck # Finds unused struct fields [fast: false, auto-fix: false]
84+
- staticcheck # Staticcheck is a go vet on steroids, applying a ton of static analysis checks [fast: false, auto-fix: false]
8085
- stylecheck # Stylecheck is a replacement for golint [fast: false, auto-fix: false]
8186
- thelper # thelper detects golang test helpers without t.Helper() call and checks the consistency of test helpers [fast: false, auto-fix: false]
8287
- typecheck # Like the front-end of a Go compiler, parses and type-checks Go code [fast: false, auto-fix: false]
8388
- unconvert # Remove unnecessary type conversions [fast: false, auto-fix: false]
8489
- unparam # Reports unused function parameters [fast: false, auto-fix: false]
8590
- unused # Checks Go code for unused constants, variables, functions and types [fast: false, auto-fix: false]
86-
- varcheck # Finds unused global variables and constants [fast: false, auto-fix: false]
8791
- whitespace # Tool for detection of leading and trailing whitespace [fast: true, auto-fix: true]
8892

89-
# don't enable:
93+
# don't enable:
9094
# - asciicheck # Simple linter to check that your code does not contain non-ASCII identifiers [fast: true, auto-fix: false]
9195
# - cyclop # checks function and package cyclomatic complexity [fast: false, auto-fix: false]
96+
# - deadcode # Finds unused code [fast: false, auto-fix: false]
9297
# - dupl # Tool for code clone detection [fast: true, auto-fix: false]
9398
# - durationcheck # check for two durations multiplied together [fast: false, auto-fix: false]
9499
# - exhaustivestruct # Checks if all struct's fields are initialized [fast: false, auto-fix: false]
@@ -98,7 +103,9 @@ linters:
98103
# - gci # Gci control golang package import order and make it always deterministic. [fast: true, auto-fix: true]
99104
# - gochecknoglobals # check that no global variables exist [fast: true, auto-fix: false]
100105
# - gocognit # Computes and checks the cognitive complexity of functions [fast: true, auto-fix: false]
106+
# - goconst # Finds repeated strings that could be replaced by a constant [fast: true, auto-fix: false]
101107
# - godox # Tool for detection of FIXME, TODO and other comment keywords [fast: true, auto-fix: false]
108+
# - gomnd # An analyzer to detect magic numbers. [fast: true, auto-fix: false]
102109
# - goerr113 # Golang linter to check the errors handling expressions [fast: false, auto-fix: false]
103110
# - gofumpt # Gofumpt checks whether code was gofumpt-ed. [fast: true, auto-fix: true]
104111
# - goheader # Checks is file header matches to pattern [fast: true, auto-fix: false]
@@ -119,9 +126,11 @@ linters:
119126
# - promlinter # Check Prometheus metrics naming via promlint [fast: true, auto-fix: false]
120127
# - scopelint # Scopelint checks for unpinned variables in go programs [fast: true, auto-fix: false]
121128
# - sqlclosecheck # Checks that sql.Rows and sql.Stmt are closed. [fast: false, auto-fix: false]
122-
# - tagliatelle # Checks the struct tags. [fast: true, auto-fix: false]
129+
# - structcheck # Finds unused struct fields [fast: false, auto-fix: false]
123130
# - testpackage # linter that makes you use a separate _test package [fast: true, auto-fix: false]
124131
# - tparallel # tparallel detects inappropriate usage of t.Parallel() method in your Go test codes [fast: false, auto-fix: false]
125132
# - wastedassign # wastedassign finds wasted assignment statements. [fast: false, auto-fix: false]
126133
# - wrapcheck # Checks that errors returned from external packages are wrapped [fast: false, auto-fix: false]
127134
# - wsl # Whitespace Linter - Forces you to use empty lines! [fast: true, auto-fix: false]
135+
# - varcheck # Finds unused global variables and constants [fast: false, auto-fix: false]
136+
# - ifshort # Checks that your code uses short syntax for if-statements whenever possible [fast: true, auto-fix: false]

appservices/appservices_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ func TestDo_noContent(t *testing.T) {
258258
client, mux, teardown := setup()
259259
defer teardown()
260260

261-
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
261+
mux.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) {
262262
w.WriteHeader(http.StatusNoContent)
263263
})
264264

@@ -275,7 +275,7 @@ func TestClient_Do_httpError(t *testing.T) {
275275
client, mux, teardown := setup()
276276
defer teardown()
277277

278-
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
278+
mux.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) {
279279
http.Error(w, "Bad Request", 400)
280280
})
281281

appservices/event_triggers_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ func TestEventTriggers_Delete(t *testing.T) {
634634

635635
path := fmt.Sprintf("/groups/%s/apps/%s/triggers/%s", groupID, appID, triggerID)
636636

637-
mux.HandleFunc(path, func(w http.ResponseWriter, r *http.Request) {
637+
mux.HandleFunc(path, func(_ http.ResponseWriter, r *http.Request) {
638638
testMethod(t, r, http.MethodDelete)
639639
})
640640

0 commit comments

Comments
 (0)