Skip to content

Commit

Permalink
Merge pull request #376 from tendermint/alessio/add-linter
Browse files Browse the repository at this point in the history
Add linter
  • Loading branch information
dongsam committed Jun 8, 2021
2 parents d626790 + 76d6891 commit e47b7af
Show file tree
Hide file tree
Showing 40 changed files with 717 additions and 654 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/lint.yml
@@ -0,0 +1,22 @@
name: Lint
# Lint runs golangci-lint over the entire cosmos-sdk repository
# This workflow is run on every pull request and push to master
# The `golangci` will pass without running if no *.{go, mod, sum} files have been changed.
on:
pull_request:
push:
branches:
- develop
jobs:
golangci:
name: golangci-lint
runs-on: ubuntu-latest
timeout-minutes: 6
steps:
- uses: actions/checkout@v2
- uses: golangci/golangci-lint-action@master
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.40
args: --timeout 10m
github-token: ${{ secrets.github_token }}
78 changes: 78 additions & 0 deletions .golangci.yml
@@ -0,0 +1,78 @@
run:
tests: false
# # timeout for analysis, e.g. 30s, 5m, default is 1m
# timeout: 5m

linters:
disable-all: true
enable:
- bodyclose
- deadcode
- depguard
- dogsled
# - errcheck
- goconst
- gocritic
- gofmt
- goimports
- golint
- gosec
- gosimple
- govet
- ineffassign
- misspell
- nakedret
- prealloc
- exportloopref
- staticcheck
- structcheck
- stylecheck
- typecheck
- unconvert
- unused
- unparam
- misspell
# - wsl
- nolintlint

issues:
exclude-rules:
- text: "Use of weak random number generator"
linters:
- gosec
- text: "comment on exported var"
linters:
- golint
- text: "don't use an underscore in package name"
linters:
- golint
- text: "ST1003:"
linters:
- stylecheck
# FIXME: Disabled until golangci-lint updates stylecheck with this fix:
# https://github.com/dominikh/go-tools/issues/389
- text: "ST1016:"
linters:
- stylecheck
- path: "legacy"
text: "SA1019:"
linters:
- staticcheck
- text: "ifElseChain:"
linters:
- gocritic

max-issues-per-linter: 10000
max-same-issues: 10000

linters-settings:
dogsled:
max-blank-identifiers: 3
maligned:
# print struct with more effective memory layout or not, false by default
suggest-new: true
nolintlint:
allow-unused: false
allow-leading-space: true
require-explanation: false
require-specific: false

0 comments on commit e47b7af

Please sign in to comment.