Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
faddat committed Dec 19, 2023
1 parent 957e746 commit dd9fda5
Show file tree
Hide file tree
Showing 130 changed files with 707 additions and 654 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,4 @@ bin/*
!.vscode/settings.json
.vendor
vendor
go.work
go.work.sum
124 changes: 88 additions & 36 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
run:
tests: true
timeout: 10m
sort-results: true
allow-parallel-runners: true
exclude-dir: testutil/testdata

linters:
disable-all: true
enable:
- dogsled
- exportloopref
- errcheck
- gci
- goconst
- gocritic
- gofumpt
Expand All @@ -19,51 +17,105 @@ linters:
- ineffassign
- misspell
- nakedret
- nolintlint
- staticcheck
- stylecheck
- thelper
- typecheck
- stylecheck
- revive
- typecheck
- tenv
- unconvert
- unparam
- unused
- misspell

issues:
exclude-rules:
- text: "Use of weak random number generator"
- text: 'differs only by capitalization to method'
linters:
- gosec
- 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:"
- revive
- text: 'Use of weak random number generator'
linters:
- gosec
- linters:
- staticcheck
- text: "leading space"
linters:
- nolintlint
text: "SA1019:" # silence errors on usage of deprecated funcs

max-issues-per-linter: 10000
max-same-issues: 10000

linters-settings:
gofumpt:
# Choose whether to use the extra rules.
module-path: github.com/notional-labs/composable-centauri
# Default: false
extra-rules: true
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
gci:
sections:
- standard # Standard section: captures all standard packages.
- default # Default section: contains all imports that could not be matched to another section type.
- blank # blank imports
- dot # dot imports
- prefix(cosmossdk.io)
- prefix(github.com/cosmos/cosmos-sdk)
- prefix(github.com/cometbft/cometbft)
- prefix(github.com/cosmos/ibc-go)
- prefix(github.com/composablefi/composable-cosmos)
custom-order: true
revive:
enable-all-rules: true
# Do NOT whine about the following, full explanation found in:
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#description-of-available-rules
rules:
- name: use-any
disabled: true
- name: if-return
disabled: true
- name: max-public-structs
disabled: true
- name: cognitive-complexity
disabled: true
- name: argument-limit
disabled: true
- name: cyclomatic
disabled: true
- name: file-header
disabled: true
- name: function-length
disabled: true
- name: function-result-limit
disabled: true
- name: line-length-limit
disabled: true
- name: flag-parameter
disabled: true
- name: add-constant
disabled: true
- name: empty-lines
disabled: true
- name: banned-characters
disabled: true
- name: deep-exit
disabled: true
- name: confusing-results
disabled: true
- name: unused-parameter
disabled: true
- name: modifies-value-receiver
disabled: true
- name: early-return
disabled: true
- name: confusing-naming
disabled: true
- name: defer
disabled: true
# Disabled in favour of unparam.
- name: unused-parameter
disabled: true
- name: unhandled-error
disabled: false
arguments:
- 'fmt.Printf'
- 'fmt.Print'
- 'fmt.Println'
- 'myFunction'
# Disabled temporarily
- name: import-shadowing
disabled: true
- name: var-naming
disabled: true
7 changes: 4 additions & 3 deletions app/ante/ante.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
package ante

import (
ibcante "github.com/cosmos/ibc-go/v7/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
tfmwKeeper "github.com/notional-labs/composable/v6/x/transfermiddleware/keeper"

"github.com/cosmos/cosmos-sdk/codec"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
sdk "github.com/cosmos/cosmos-sdk/types"
ante "github.com/cosmos/cosmos-sdk/x/auth/ante"
"github.com/cosmos/cosmos-sdk/x/auth/signing"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
tfmwKeeper "github.com/notional-labs/composable/v6/x/transfermiddleware/keeper"

ibcante "github.com/cosmos/ibc-go/v7/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
)

// Link to default ante handler used by cosmos sdk:
Expand Down
7 changes: 4 additions & 3 deletions app/ante/ibc_ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ package ante
import (
"fmt"

tfmwKeeper "github.com/notional-labs/composable/v6/x/transfermiddleware/keeper"

errorsmod "cosmossdk.io/errors"

"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/cosmos/cosmos-sdk/x/authz"
clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"

tfmwKeeper "github.com/notional-labs/composable/v6/x/transfermiddleware/keeper"
clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
)

type IBCPermissionDecorator struct {
Expand Down
104 changes: 44 additions & 60 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,36 @@ import (
"path/filepath"
"strings"

nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node"
authante "github.com/cosmos/cosmos-sdk/x/auth/ante"
authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation"
"github.com/cosmos/cosmos-sdk/x/authz"
"github.com/cosmos/cosmos-sdk/x/consensus"
tendermint "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"
wasm08 "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm"
wasm08keeper "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/keeper"

wasm08types "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/types"
"github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
router "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward"
routertypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/types"
"github.com/notional-labs/composable/v6/app/ante"
"github.com/notional-labs/composable/v6/app/keepers"
"github.com/notional-labs/composable/v6/app/prepare"
upgrades "github.com/notional-labs/composable/v6/app/upgrades"
v4 "github.com/notional-labs/composable/v6/app/upgrades/v4"
v5 "github.com/notional-labs/composable/v6/app/upgrades/v5"
v6 "github.com/notional-labs/composable/v6/app/upgrades/v6"
custombankmodule "github.com/notional-labs/composable/v6/custom/bank"
ibc_hooks "github.com/notional-labs/composable/v6/x/ibc-hooks"
ibchookstypes "github.com/notional-labs/composable/v6/x/ibc-hooks/types"
"github.com/notional-labs/composable/v6/x/mint"
minttypes "github.com/notional-labs/composable/v6/x/mint/types"
ratelimitmodule "github.com/notional-labs/composable/v6/x/ratelimit"
ratelimitmoduletypes "github.com/notional-labs/composable/v6/x/ratelimit/types"
transfermiddleware "github.com/notional-labs/composable/v6/x/transfermiddleware"
transfermiddlewaretypes "github.com/notional-labs/composable/v6/x/transfermiddleware/types"
txBoundary "github.com/notional-labs/composable/v6/x/tx-boundary"
txBoundaryTypes "github.com/notional-labs/composable/v6/x/tx-boundary/types"
"github.com/spf13/cast"
icq "github.com/strangelove-ventures/async-icq/v7"
icqtypes "github.com/strangelove-ventures/async-icq/v7/types"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node"
"github.com/cosmos/cosmos-sdk/client/grpc/tmservice"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"
Expand All @@ -29,25 +46,21 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/x/auth"
authante "github.com/cosmos/cosmos-sdk/x/auth/ante"
authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation"
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/auth/vesting"
vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
"github.com/cosmos/cosmos-sdk/x/bank"

"github.com/notional-labs/composable/v6/app/keepers"
"github.com/notional-labs/composable/v6/app/prepare"
v4 "github.com/notional-labs/composable/v6/app/upgrades/v4"
v5 "github.com/notional-labs/composable/v6/app/upgrades/v5"
v6 "github.com/notional-labs/composable/v6/app/upgrades/v6"

// bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"

"github.com/cosmos/cosmos-sdk/x/authz"
authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module"
"github.com/cosmos/cosmos-sdk/x/bank"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/capability"
capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
"github.com/cosmos/cosmos-sdk/x/consensus"
consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
"github.com/cosmos/cosmos-sdk/x/crisis"
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
distr "github.com/cosmos/cosmos-sdk/x/distribution"
Expand All @@ -61,15 +74,8 @@ import (
"github.com/cosmos/cosmos-sdk/x/gov"
govclient "github.com/cosmos/cosmos-sdk/x/gov/client"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"

"github.com/cosmos/cosmos-sdk/x/group"
groupmodule "github.com/cosmos/cosmos-sdk/x/group/module"

dbm "github.com/cometbft/cometbft-db"
abci "github.com/cometbft/cometbft/abci/types"
tmjson "github.com/cometbft/cometbft/libs/json"
"github.com/cometbft/cometbft/libs/log"
tmos "github.com/cometbft/cometbft/libs/os"
"github.com/cosmos/cosmos-sdk/x/params"
paramsclient "github.com/cosmos/cosmos-sdk/x/params/client"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
Expand All @@ -80,6 +86,13 @@ import (
"github.com/cosmos/cosmos-sdk/x/upgrade"
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

dbm "github.com/cometbft/cometbft-db"
abci "github.com/cometbft/cometbft/abci/types"
tmjson "github.com/cometbft/cometbft/libs/json"
"github.com/cometbft/cometbft/libs/log"
tmos "github.com/cometbft/cometbft/libs/os"

ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts"
icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types"
"github.com/cosmos/ibc-go/v7/modules/apps/transfer"
Expand All @@ -89,40 +102,11 @@ import (
ibcclientclient "github.com/cosmos/ibc-go/v7/modules/core/02-client/client"
ibchost "github.com/cosmos/ibc-go/v7/modules/core/exported"
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
"github.com/spf13/cast"
icq "github.com/strangelove-ventures/async-icq/v7"
icqtypes "github.com/strangelove-ventures/async-icq/v7/types"

router "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward"
routertypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/types"

custombankmodule "github.com/notional-labs/composable/v6/custom/bank"

"github.com/notional-labs/composable/v6/app/ante"
transfermiddleware "github.com/notional-labs/composable/v6/x/transfermiddleware"
transfermiddlewaretypes "github.com/notional-labs/composable/v6/x/transfermiddleware/types"

txBoundary "github.com/notional-labs/composable/v6/x/tx-boundary"
txBoundaryTypes "github.com/notional-labs/composable/v6/x/tx-boundary/types"

ratelimitmodule "github.com/notional-labs/composable/v6/x/ratelimit"
ratelimitmoduletypes "github.com/notional-labs/composable/v6/x/ratelimit/types"

consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types"

"github.com/notional-labs/composable/v6/x/mint"
minttypes "github.com/notional-labs/composable/v6/x/mint/types"

tendermint "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"
wasm08 "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm"
wasm08keeper "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/keeper"
wasm08types "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/types"
ibctestingtypes "github.com/cosmos/ibc-go/v7/testing/types"

ibc_hooks "github.com/notional-labs/composable/v6/x/ibc-hooks"
ibchookstypes "github.com/notional-labs/composable/v6/x/ibc-hooks/types"

"github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"

upgrades "github.com/notional-labs/composable/v6/app/upgrades"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions app/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import (
"encoding/json"
"log"

tmproto "github.com/cometbft/cometbft/proto/tendermint/types"

servertypes "github.com/cosmos/cosmos-sdk/server/types"
sdk "github.com/cosmos/cosmos-sdk/types"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
"github.com/cosmos/cosmos-sdk/x/staking"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"

tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
)

// ExportAppStateAndValidators exports the state of the application for a genesis
Expand Down
Loading

0 comments on commit dd9fda5

Please sign in to comment.