Skip to content

Commit

Permalink
add golangci-lint
Browse files Browse the repository at this point in the history
  • Loading branch information
turbolent committed Jun 13, 2024
1 parent adad770 commit 20dd4b7
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 71 deletions.
32 changes: 24 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,11 @@ jobs:
restore-keys: |
${{ runner.os }}-go-
- name: Test
run: make test-test
working-directory: test
run: make test
- name: Check tidy
run: make check-tidy-test
working-directory: test
run: make check-tidy

test-lint:
needs: paths-filter
Expand All @@ -80,9 +82,11 @@ jobs:
restore-keys: |
${{ runner.os }}-go-
- name: Test
run: make test-lint
working-directory: lint
run: make test
- name: Check tidy
run: make check-tidy-lint
working-directory: lint
run: make check-tidy

test-languageserver:
needs: paths-filter
Expand Down Expand Up @@ -111,9 +115,11 @@ jobs:
working-directory: languageserver
run: make build
- name: Test
run: make test-languageserver
working-directory: languageserver
run: make test
- name: Check tidy
run: make check-tidy-languageserver
working-directory: languageserver
run: make check-tidy

test-docgen:
needs: paths-filter
Expand All @@ -136,9 +142,11 @@ jobs:
restore-keys: |
${{ runner.os }}-go-
- name: Test
run: make test-docgen
working-directory: docgen
run: make test
- name: Check tidy
run: make check-tidy-docgen
working-directory: docgen
run: make check-tidy

lint:
name: Lint
Expand All @@ -158,3 +166,11 @@ jobs:
${{ runner.os }}-go-
- name: Check license headers
run: make check-headers
- name: Run golangci-lint
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.54
args: -v
# https://github.com/golangci/golangci-lint-action/issues/244
skip-cache: true
39 changes: 39 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
linters:
disable-all: true
enable:
- govet
- gosimple
- errcheck
- staticcheck
- ineffassign
- typecheck
- misspell
- unused
- exportloopref
- gocritic
- gofmt
- goimports
- unconvert
- nilerr
- forbidigo
- bidichk
- asciicheck

issues:
max-issues-per-linter: 0
max-same-issues: 0

linters-settings:
gocritic:
disabled-checks:
- ifElseChain # style
- singleCaseSwitch # style
- unslice # false positives
- commentFormatting # does not detect commented out code
- exitAfterDefer
goimports:
local-prefixes: github.com/onflow/cadence-tools
forbidigo:
forbid:
- '^maps.Keys.*(# has indeterminate order\.)?$'
- '^maps.Values.*(# has indeterminate order\.)?$'
63 changes: 0 additions & 63 deletions Makefile

This file was deleted.

0 comments on commit 20dd4b7

Please sign in to comment.