Skip to content

Commit

Permalink
Update linter rules
Browse files Browse the repository at this point in the history
  • Loading branch information
tkxkd0159 committed Jun 25, 2024
1 parent 48abb78 commit 0f02655
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- uses: golangci/golangci-lint-action@v6
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.51
version: v1.59
args: --timeout 10m
github-token: ${{ secrets.GITHUB_TOKEN }}
if: env.GIT_DIFF
46 changes: 31 additions & 15 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,40 @@
linters:
disable-all: true
enable:
- bodyclose
- dogsled
- errcheck
- goconst
- gocritic
- gofmt
- goimports
- gosec
- gosimple
- govet
- ineffassign
- misspell
- nakedret
- prealloc
- staticcheck
- unused
- dogsled
- gosec
- gci
- gofumpt
- goconst
- gocritic
- nakedret
- nolintlint
- revive
- misspell
- stylecheck
- typecheck
- thelper
- unconvert
- asasalint
- asciicheck
- bidichk
- bodyclose
- copyloopvar
- errchkjson
- errorlint
- tenv
- wastedassign
- fatcontext
- dupl
- unparam
- unused
- gocyclo
- whitespace
- dupl
- revive
- exportloopref
- prealloc

issues:
exclude-rules:
Expand Down Expand Up @@ -57,6 +67,12 @@ linters-settings:
# Default is to use a neutral variety of English.
# Setting locale to US will correct the British spelling of 'colour' to 'color'.
locale: US
gci:
custom-order: true
sections:
- standard # Standard section: captures all standard packages.
- default # Default section: contains all imports that could not be matched to another section type.
- prefix(github.com/Finschia/finschia-sdk)
run:
# default concurrency is a available CPU number
concurrency: 4
Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,13 @@ docker-build:
### Linting ###
###############################################################################

lint:
golangci-lint run
lint: golangci-lint
golangci-lint run --out-format=tab
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" | xargs gofmt -d -s

golangci-lint:
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.59

format:
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/docs/statik/statik.go" | xargs gofmt -w -s
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/docs/statik/statik.go" | xargs misspell -w
Expand Down

0 comments on commit 0f02655

Please sign in to comment.