Skip to content

Commit

Permalink
golangci-lint: enable containedctx
Browse files Browse the repository at this point in the history
  • Loading branch information
jmank88 committed May 23, 2024
1 parent 41e7f9b commit 2f98594
Show file tree
Hide file tree
Showing 4 changed files with 145 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pull-request-main.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: pull-request-master
name: pull-request-main

on:
merge_group:
pull_request:
branches:
- master
- main
# Only run 1 of this workflow at a time per PR
concurrency:
group: chainlink-vrf-${{ github.ref }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/push-main.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: push-master
name: push-main

on:
push:
branches:
- master
- main

env:
PACKAGES: "./..."
Expand Down
121 changes: 121 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
run:
timeout: 10m0s
linters:
enable:
- exhaustive
- exportloopref
- revive
- goimports
- gosec
- misspell
- rowserrcheck
- errorlint
- unconvert
- sqlclosecheck
- noctx
- whitespace
- depguard
- containedctx
linters-settings:
exhaustive:
default-signifies-exhaustive: true
goimports:
local-prefixes: github.com/smartcontractkit/chainlink-vrf
golint:
min-confidence: 1.0
gosec:
excludes:
- G101
- G104
# - G204
# - G304
# - G404
govet:
# report about shadowed variables
check-shadowing: true
errorlint:
# Allow formatting of errors without %w
errorf: false
revive:
confidence: 0.8
rules:
- name: blank-imports
- name: context-as-argument
- name: context-keys-type
- name: dot-imports
- name: error-return
- name: error-strings
- name: error-naming
- name: exported
- 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: unused-parameter
- name: unreachable-code
- name: redefines-builtin-id
- name: waitgroup-by-value
- name: unconditional-recursion
- name: struct-tag
# - name: string-format
- name: string-of-int
- name: range-val-address
- name: range-val-in-closure
- name: modifies-value-receiver
- name: modifies-parameter
- name: identical-branches
- name: get-return
# - name: flag-parameter
- name: early-return
- name: defer
- name: constant-logical-expr
# - name: confusing-naming
# - name: confusing-results
- name: bool-literal-in-expr
- name: atomic
depguard:
rules:
main:
list-mode: lax
deny:
- pkg: "cosmossdk.io/errors"
desc: Use the standard library instead
- pkg: "github.com/ethereum/go-ethereum"
desc: This is a chain-agnostic repo
- pkg: "github.com/go-gorm/gorm"
desc: Use github.com/jmoiron/sqlx directly instead
- pkg: "github.com/gofrs/uuid"
desc: Use github.com/google/uuid instead
- pkg: "github.com/pkg/errors"
desc: Use the standard library instead, for example https://pkg.go.dev/errors#Join
- pkg: "github.com/satori/go.uuid"
desc: Use github.com/google/uuid instead
- pkg: "github.com/test-go/testify/assert"
desc: Use github.com/stretchr/testify/assert instead
- pkg: "github.com/test-go/testify/mock"
desc: Use github.com/stretchr/testify/mock instead
- pkg: "github.com/test-go/testify/require"
desc: Use github.com/stretchr/testify/require instead
- pkg: "go.uber.org/multierr"
desc: Use the standard library instead, for example https://pkg.go.dev/errors#Join
- pkg: "gopkg.in/guregu/null.v1"
desc: Use gopkg.in/guregu/null.v4 instead
- pkg: "gopkg.in/guregu/null.v2"
desc: Use gopkg.in/guregu/null.v4 instead
- pkg: "gopkg.in/guregu/null.v3"
desc: Use gopkg.in/guregu/null.v4 instead
issues:
exclude-rules:
- path: test
text: "^G404:"
linters:
- gosec
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
SHELL=/bin/bash -o pipefail

.PHONY: all
all: build

.PHONY: build
build:
go build ./...

.PHONY: test
test:
go test ./...

.PHONY: lint
lint:
golangci-lint run ./...

.PHONY: tidy
tidy:
go mod tidy

0 comments on commit 2f98594

Please sign in to comment.