Skip to content

Commit 0047118

Browse files
Danielius1922Daniel Adam
authored andcommitted
Enable additional linters and fix reported issues
1 parent 75000ae commit 0047118

31 files changed

+697
-742
lines changed

.github/workflows/staticAnalysis.yml

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,33 +20,12 @@ jobs:
2020
- name: Run go vet
2121
run: go vet ./...
2222

23-
- name: Install and run ineffassign
24-
run: |
25-
export PATH=${PATH}:`go env GOPATH`/bin
26-
go install github.com/gordonklaus/ineffassign@latest
27-
ineffassign ./...
28-
29-
- name: Install and run errcheck
30-
run: |
31-
export PATH=${PATH}:`go env GOPATH`/bin
32-
go install github.com/kisielk/errcheck@latest
33-
if errcheck ./... | grep -v 'example'; then\
34-
exit 1;\
35-
fi
36-
3723
- name: Install and run gocyclo
3824
run: |
3925
export PATH=${PATH}:`go env GOPATH`/bin
4026
go install github.com/fzipp/gocyclo/cmd/gocyclo@latest
4127
gocyclo -over 15 -ignore ".pb(.gw)?.go$|_test.go$|wsproxy" . || echo "gocyclo detected too complex functions"
4228
43-
- name: Install and run misspell
44-
run: |
45-
# check misspelling in all files in repository
46-
export PATH=${PATH}:`go env GOPATH`/bin
47-
go install github.com/client9/misspell/cmd/misspell@latest
48-
find . -type f -exec misspell {} \;
49-
5029
# Disable aligncheck until it is compatible with golang v1.18
5130
# - name: Install and run aligncheck
5231
# run: |

.golangci.yml

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
11
linters-settings:
22
govet:
3-
# check-shadowing: true
4-
check-shadowing: false
5-
exhaustive:
6-
default-signifies-exhaustive: true
7-
gomodguard:
8-
blocked:
9-
modules:
10-
- github.com/pkg/errors:
11-
recommendations:
12-
- errors
3+
check-shadowing: true
4+
gocyclo:
5+
min-complexity: 15
136

147
linters:
158
enable:
@@ -22,7 +15,7 @@ linters:
2215
- depguard # Go linter that checks if package imports are in a list of acceptable packages
2316
# - dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f())
2417
# - dupl # Tool for code clone detection
25-
# - durationcheck # check for two durations multiplied together
18+
- durationcheck # check for two durations multiplied together
2619
- errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases
2720
- errchkjson # Checks types passed to the json encoding functions. Reports unsupported types and optionally reports occations, where the check for the returned error can be omitted.
2821
# - errname # Checks that sentinel errors are prefixed with the `Err` and error types are suffixed with the `Error`.
@@ -31,7 +24,7 @@ linters:
3124
- exportloopref # checks for pointers to enclosing loop variables
3225
# - forbidigo # Forbids identifiers
3326
# - forcetypeassert # finds forced type assertions
34-
# - gci # Gci control golang package import order and make it always deterministic.
27+
- gci # Gci control golang package import order and make it always deterministic.
3528
# - gochecknoglobals # Checks that no globals are present in Go code
3629
# - gochecknoinits # Checks that no init functions are present in Go code
3730
# - gocognit # Computes and checks the cognitive complexity of functions
@@ -69,7 +62,7 @@ linters:
6962
- typecheck # Like the front-end of a Go compiler, parses and type-checks Go code
7063
- unconvert # Remove unnecessary type conversions
7164
# - unparam # Reports unused function parameters
72-
# - unused # Checks Go code for unused constants, variables, functions and types
65+
- unused # Checks Go code for unused constants, variables, functions and types
7366
- varcheck # Finds unused global variables and constants
7467
# - wastedassign # wastedassign finds wasted assignment statements
7568
- whitespace # Tool for detection of leading and trailing whitespace

0 commit comments

Comments
 (0)