Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: setup lint runs in CI and add more linters #18

Merged
merged 1 commit into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/pull-request-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ on:
- main

jobs:
ci-lint:
name: Lint
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
actions: read
steps:
- name: Linting Go
uses: smartcontractkit/.github/actions/ci-lint-go@7a4d99cb349ea8f25195d2390d157942031f8a57
with:
golangci-lint-version: v1.61.0

ci-test:
name: Tests
runs-on: ubuntu-latest
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/push-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ on:
- main

jobs:
ci-lint:
name: Lint
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
actions: read
steps:
- name: Linting Go
uses: smartcontractkit/.github/actions/ci-lint-go@7a4d99cb349ea8f25195d2390d157942031f8a57
with:
golangci-lint-version: v1.61.0

ci-test:
runs-on: ubuntu-latest
permissions:
Expand Down
79 changes: 79 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
run:
timeout: 5m
linters:
enable:
- asciicheck
- bidichk
- containedctx
- contextcheck
- copyloopvar
- decorder
- dogsled
- dupword
- durationcheck
# - err113 # disabled because it currently fails on the codebase
- errchkjson
# - errname # disabled because it currently fails on the codebase
- errorlint
- exhaustive
- fatcontext
# - forbidigo # disabled because it currently fails on the codebase in gethwrappers
- gci
- goconst
- gofmt
# - goimports # disabled because it currently fails on the codebase
# - gosec # disabled because it currently fails on the codebase in many places
# - intrange # disabled because it currently fails on the codebase
- makezero
- loggercheck
- makezero
- misspell
# - mnd # disabled because it currently fails on the codebase
- nilerr
- nilnil
# - nlreturn # disabled because it currently fails on the codebase
- nolintlint
# - paralleltest # Discussion whether we should have this
# - prealloc # disabled because it currently fails on the codebase
- reassign
# - revive # disabled because it currently fails on the codebase
# - testifylint # disabled because it currently fails on the codebase
- thelper
- tparallel
# - unconvert # disabled because it currently fails on the codebase
# - unparam # disabled because it currently fails on the codebase
- usestdlibvars
- wastedassign
# - whitespace # disabled because it currently fails on codebase
linters-settings:
goconst:
min-len: 5
# goimports:
# local-prefixes: github.com/smartcontractkit/mcms
# govet:
# enable:
# - shadow
# revive:
# confidence: 1.0
# rules:
# - name: context-as-argument
# - name: context-keys-type
# - name: dot-imports
# - name: error-return
# - name: error-strings
# - name: error-naming
# - name: if-return
# - name: increment-decrement
# - name: var-naming
# - name: var-declaration
# - name: package-comments
# - name: range
# - name: receiver-naming
# - name: time-naming
# - name: unexported-return
# - name: indent-error-flow
# - name: errorf
# - name: empty-block
# - name: superfluous-else
# - name: unreachable-code
# - name: redefines-builtin-id
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,11 @@ Run the entire test suite with:
`task test`

More `test` commands can be found by running `task -l`

### Running Linters

Run the linters with:

`task lint`

More `lint` commands can be found by running `task -l`
2 changes: 1 addition & 1 deletion taskfiles/lint/Taskfile.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3'

tasks:
check:
default:
desc: "Run Go lint checks"
cmds:
- golangci-lint run
Expand Down
Loading