Skip to content

Commit

Permalink
chore: enables the forbidigo, unparam and gosec linter (#28)
Browse files Browse the repository at this point in the history
The gosec linter has some excludes rules (G115 and G306) which will
still need to be resolved.

The unparam linter is excluded from test files because there are usually
parameters in helper functions which have false positives.
  • Loading branch information
jkongie authored Oct 8, 2024
1 parent f675380 commit e341509
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
15 changes: 11 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,16 @@ linters:
- 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
- forbidigo
- goconst
- gofmt
- goimports
# - gosec # disabled because it currently fails on the codebase in many places
- gosec
- intrange
- makezero
- loggercheck
Expand All @@ -40,7 +39,7 @@ linters:
- thelper
- tparallel
- unconvert
# - unparam # disabled because it currently fails on the codebase
- unparam
- usestdlibvars
- wastedassign
- whitespace
Expand All @@ -49,6 +48,10 @@ linters-settings:
min-len: 5
goimports:
local-prefixes: github.com/smartcontractkit/mcms
gosec:
excludes:
- G115 # TODO: Resolve integer overflow issues
- G306 # TODO: Resolve WriteFile permissions issues
# govet:
# enable:
# - shadow
Expand Down Expand Up @@ -94,3 +97,7 @@ issues:
# Exclude the directory from linting because it will soon be removed and only contains
# generated code. Can be removed once the gethwrappers directory is removed.
- pkg/gethwrappers
exclude-rules:
- path: _test\.go
linters:
- unparam # No need to check for unused parameters in tests, since there are often false positives
8 changes: 6 additions & 2 deletions pkg/proposal/mcms/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,15 @@ func buildRootMetadatas(
if isSim {
chain.EvmChainID = 1337
}

preOpCount := new(big.Int).SetUint64(metadata.StartingOpCount)
postOpCount := new(big.Int).SetUint64(metadata.StartingOpCount + currentTxCount)

rootMetadatas[chainID] = gethwrappers.ManyChainMultiSigRootMetadata{
ChainId: new(big.Int).SetUint64(chain.EvmChainID),
MultiSig: metadata.MCMAddress,
PreOpCount: big.NewInt(int64(metadata.StartingOpCount)), // TODO: handle overflow
PostOpCount: big.NewInt(int64(metadata.StartingOpCount) + int64(currentTxCount)), // TODO: handle overflow
PreOpCount: preOpCount,
PostOpCount: postOpCount,
OverridePreviousRoot: overridePreviousRoot,
}
}
Expand Down

0 comments on commit e341509

Please sign in to comment.