diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..0589fcf --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,26 @@ +name: golangci-lint +on: + push: + tags: + - v* + branches: + - main + pull_request: +permissions: + contents: read + # Optional: allow read access to pull request. Use with `only-new-issues` option. + # pull-requests: read +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v3 + with: + go-version: 1.19 + - uses: actions/checkout@v3 + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version + version: latest diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..b7bc832 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,68 @@ +run: + tests: true + # timeout for analysis, e.g. 30s, 5m, default is 1m + timeout: 5m + +linters: + disable-all: true + enable: + - depguard + - dogsled + - errcheck + - exportloopref + - goconst + - gocritic + - gofumpt + - gosec + - gosimple + - govet + - ineffassign + - misspell + - nakedret + - nolintlint + - revive + - staticcheck + - stylecheck + - typecheck + - unconvert + - unparam + - unused + +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: "migrations" + text: "SA1019:" + linters: + - staticcheck + + 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 diff --git a/app/ante.go b/app/ante.go index 4e0cba7..6dd27f2 100644 --- a/app/ante.go +++ b/app/ante.go @@ -40,11 +40,6 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "sign mode handler is required for ante builder") } - sigGasConsumer := options.SigGasConsumer - if sigGasConsumer == nil { - sigGasConsumer = ante.DefaultSigVerificationGasConsumer - } - anteDecorators := []sdk.AnteDecorator{ ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first wasmkeeper.NewLimitSimulationGasDecorator(options.WasmConfig.SimulationGasLimit), diff --git a/app/app.go b/app/app.go index 41393e0..07b17c3 100644 --- a/app/app.go +++ b/app/app.go @@ -2,13 +2,14 @@ package app import ( "fmt" - "github.com/CosmWasm/wasmd/x/wasm" - wasmTypes "github.com/CosmWasm/wasmd/x/wasm/types" "io" "net/http" "os" "path/filepath" + "github.com/CosmWasm/wasmd/x/wasm" + wasmTypes "github.com/CosmWasm/wasmd/x/wasm/types" + "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" diff --git a/app/simulation_test.go b/app/simulation_test.go index abffaa2..0497800 100644 --- a/app/simulation_test.go +++ b/app/simulation_test.go @@ -3,15 +3,11 @@ package app_test import ( "os" "testing" - "time" "github.com/cosmos/cosmos-sdk/simapp" simulationtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/simulation" "github.com/stretchr/testify/require" - abci "github.com/tendermint/tendermint/abci/types" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - tmtypes "github.com/tendermint/tendermint/types" "github.com/terra-money/feather-core/app" ) @@ -20,23 +16,6 @@ func init() { simapp.GetSimulatorFlags() } -var defaultConsensusParams = &abci.ConsensusParams{ - Block: &abci.BlockParams{ - MaxBytes: 200000, - MaxGas: 2000000, - }, - Evidence: &tmproto.EvidenceParams{ - MaxAgeNumBlocks: 302400, - MaxAgeDuration: 504 * time.Hour, // 3 weeks is the max duration - MaxBytes: 10000, - }, - Validator: &tmproto.ValidatorParams{ - PubKeyTypes: []string{ - tmtypes.ABCIPubKeyTypeEd25519, - }, - }, -} - // BenchmarkSimulation run the chain simulation // Running using starport command: // `starport chain simulate -v --numBlocks 200 --blockSize 50` diff --git a/cmd/feather-cored/cmd/root.go b/cmd/feather-cored/cmd/root.go index 013bab1..d3a4e00 100644 --- a/cmd/feather-cored/cmd/root.go +++ b/cmd/feather-cored/cmd/root.go @@ -34,6 +34,7 @@ import ( tmcli "github.com/tendermint/tendermint/libs/cli" "github.com/tendermint/tendermint/libs/log" dbm "github.com/tendermint/tm-db" + // this line is used by starport scaffolding # root/moduleImport "github.com/terra-money/feather-core/app" @@ -229,7 +230,7 @@ func overwriteFlagDefaults(c *cobra.Command, defaults map[string]string) { set := func(s *pflag.FlagSet, key, val string) { if f := s.Lookup(key); f != nil { f.DefValue = val - f.Value.Set(val) + f.Value.Set(val) //nolint:errcheck } } for key, val := range defaults {