Skip to content

Commit

Permalink
Enable additional linters and fix reported issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Danielius1922 authored and Daniel Adam committed Jun 15, 2022
1 parent 75000ae commit 0047118
Show file tree
Hide file tree
Showing 31 changed files with 697 additions and 742 deletions.
21 changes: 0 additions & 21 deletions .github/workflows/staticAnalysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,12 @@ jobs:
- name: Run go vet
run: go vet ./...

- name: Install and run ineffassign
run: |
export PATH=${PATH}:`go env GOPATH`/bin
go install github.com/gordonklaus/ineffassign@latest
ineffassign ./...
- name: Install and run errcheck
run: |
export PATH=${PATH}:`go env GOPATH`/bin
go install github.com/kisielk/errcheck@latest
if errcheck ./... | grep -v 'example'; then\
exit 1;\
fi
- name: Install and run gocyclo
run: |
export PATH=${PATH}:`go env GOPATH`/bin
go install github.com/fzipp/gocyclo/cmd/gocyclo@latest
gocyclo -over 15 -ignore ".pb(.gw)?.go$|_test.go$|wsproxy" . || echo "gocyclo detected too complex functions"
- name: Install and run misspell
run: |
# check misspelling in all files in repository
export PATH=${PATH}:`go env GOPATH`/bin
go install github.com/client9/misspell/cmd/misspell@latest
find . -type f -exec misspell {} \;
# Disable aligncheck until it is compatible with golang v1.18
# - name: Install and run aligncheck
# run: |
Expand Down
19 changes: 6 additions & 13 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
linters-settings:
govet:
# check-shadowing: true
check-shadowing: false
exhaustive:
default-signifies-exhaustive: true
gomodguard:
blocked:
modules:
- github.com/pkg/errors:
recommendations:
- errors
check-shadowing: true
gocyclo:
min-complexity: 15

linters:
enable:
Expand All @@ -22,7 +15,7 @@ linters:
- depguard # Go linter that checks if package imports are in a list of acceptable packages
# - dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f())
# - dupl # Tool for code clone detection
# - durationcheck # check for two durations multiplied together
- durationcheck # check for two durations multiplied together
- errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases
- 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.
# - errname # Checks that sentinel errors are prefixed with the `Err` and error types are suffixed with the `Error`.
Expand All @@ -31,7 +24,7 @@ linters:
- exportloopref # checks for pointers to enclosing loop variables
# - forbidigo # Forbids identifiers
# - forcetypeassert # finds forced type assertions
# - gci # Gci control golang package import order and make it always deterministic.
- gci # Gci control golang package import order and make it always deterministic.
# - gochecknoglobals # Checks that no globals are present in Go code
# - gochecknoinits # Checks that no init functions are present in Go code
# - gocognit # Computes and checks the cognitive complexity of functions
Expand Down Expand Up @@ -69,7 +62,7 @@ linters:
- typecheck # Like the front-end of a Go compiler, parses and type-checks Go code
- unconvert # Remove unnecessary type conversions
# - unparam # Reports unused function parameters
# - unused # Checks Go code for unused constants, variables, functions and types
- unused # Checks Go code for unused constants, variables, functions and types
- varcheck # Finds unused global variables and constants
# - wastedassign # wastedassign finds wasted assignment statements
- whitespace # Tool for detection of leading and trailing whitespace
Expand Down
Loading

0 comments on commit 0047118

Please sign in to comment.