Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
tkxkd0159 committed Jun 25, 2024
1 parent d94acd7 commit 3ba0031
Show file tree
Hide file tree
Showing 17 changed files with 108 additions and 69 deletions.
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ linters-settings:
sections:
- standard # Standard section: captures all standard packages.
- default # Default section: contains all imports that could not be matched to another section type.
- prefix(github.com/Finschia/ostracon)
- prefix(github.com/Finschia/ibc-go)
- prefix(github.com/Finschia/wasmd)
- prefix(github.com/Finschia/finschia-sdk)
- prefix(github.com/Finschia/finschia)
run:
# default concurrency is a available CPU number
concurrency: 4
Expand Down
5 changes: 3 additions & 2 deletions ante/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import (
ibcante "github.com/cosmos/ibc-go/v4/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v4/modules/core/keeper"

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

sdk "github.com/Finschia/finschia-sdk/types"
sdkerrors "github.com/Finschia/finschia-sdk/types/errors"
"github.com/Finschia/finschia-sdk/x/auth/ante"
wasmkeeper "github.com/Finschia/wasmd/x/wasm/keeper"
wasmtypes "github.com/Finschia/wasmd/x/wasm/types"
)

// HandlerOptions extend the SDK's AnteHandler options by requiring the IBC
Expand Down
3 changes: 2 additions & 1 deletion ante/ante_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"github.com/stretchr/testify/suite"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"

ocrand "github.com/Finschia/ostracon/libs/rand"

"github.com/Finschia/finschia-sdk/client"
"github.com/Finschia/finschia-sdk/client/tx"
cryptotypes "github.com/Finschia/finschia-sdk/crypto/types"
Expand All @@ -15,7 +17,6 @@ import (
sdk "github.com/Finschia/finschia-sdk/types"
"github.com/Finschia/finschia-sdk/types/tx/signing"
xauthsigning "github.com/Finschia/finschia-sdk/x/auth/signing"
ocrand "github.com/Finschia/ostracon/libs/rand"

linkapp "github.com/Finschia/finschia/v4/app"
linkhelpers "github.com/Finschia/finschia/v4/app/helpers"
Expand Down
34 changes: 19 additions & 15 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ import (
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
dbm "github.com/tendermint/tm-db"

ocabci "github.com/Finschia/ostracon/abci/types"
"github.com/Finschia/ostracon/libs/log"
ostos "github.com/Finschia/ostracon/libs/os"

"github.com/Finschia/wasmd/x/wasm"
wasmclient "github.com/Finschia/wasmd/x/wasm/client"
wasmkeeper "github.com/Finschia/wasmd/x/wasm/keeper"
"github.com/Finschia/wasmd/x/wasmplus"
wasmpluskeeper "github.com/Finschia/wasmd/x/wasmplus/keeper"
wasmplustypes "github.com/Finschia/wasmd/x/wasmplus/types"

"github.com/Finschia/finschia-sdk/baseapp"
"github.com/Finschia/finschia-sdk/client"
nodeservice "github.com/Finschia/finschia-sdk/client/grpc/node"
Expand Down Expand Up @@ -120,23 +131,16 @@ import (
upgradeclient "github.com/Finschia/finschia-sdk/x/upgrade/client"
upgradekeeper "github.com/Finschia/finschia-sdk/x/upgrade/keeper"
upgradetypes "github.com/Finschia/finschia-sdk/x/upgrade/types"
ocabci "github.com/Finschia/ostracon/abci/types"
"github.com/Finschia/ostracon/libs/log"
ostos "github.com/Finschia/ostracon/libs/os"
"github.com/Finschia/wasmd/x/wasm"
wasmclient "github.com/Finschia/wasmd/x/wasm/client"
wasmkeeper "github.com/Finschia/wasmd/x/wasm/keeper"
"github.com/Finschia/wasmd/x/wasmplus"
wasmpluskeeper "github.com/Finschia/wasmd/x/wasmplus/keeper"
wasmplustypes "github.com/Finschia/wasmd/x/wasmplus/types"

appante "github.com/Finschia/finschia/v4/ante"
appparams "github.com/Finschia/finschia/v4/app/params"
_ "github.com/Finschia/finschia/v4/client/docs/statik" // unnamed import of statik for swagger UI support
)

const appName = "Finschia"
const upgradeName = "v4-Marigold"
const (
appName = "Finschia"
upgradeName = "v4-Marigold"
)

var (
// DefaultNodeHome default home directories for the application daemon
Expand Down Expand Up @@ -216,7 +220,7 @@ var (
// LinkApp extends an ABCI application, but with most of its parameters exported.
// They are exported for convenience in creating helper functions, as object
// capabilities aren't needed for testing.
type LinkApp struct { // nolint: golint
type LinkApp struct { //nolint: golint
*baseapp.BaseApp
legacyAmino *codec.LegacyAmino
appCodec codec.Codec
Expand Down Expand Up @@ -504,7 +508,7 @@ func NewLinkApp(
/**** Module Options ****/

/**** Module Options ****/
var skipGenesisInvariants = false
skipGenesisInvariants := false
opt := appOpts.Get(crisis.FlagSkipGenesisInvariants)
if opt, ok := opt.(bool); ok {
skipGenesisInvariants = opt
Expand Down Expand Up @@ -699,7 +703,7 @@ func NewLinkApp(
wasmkeeper.NewWasmSnapshotter(app.CommitMultiStore(), &app.WasmKeeper.Keeper),
)
if err != nil {
panic(fmt.Errorf("failed to register snapshot extension: %s", err))
panic(fmt.Errorf("failed to register snapshot extension: %w", err))
}
}

Expand Down Expand Up @@ -890,7 +894,7 @@ func (app *LinkApp) setupUpgradeStoreLoaders() {
func (app *LinkApp) setupUpgradeHandlers() {
app.UpgradeKeeper.SetUpgradeHandler(
upgradeName,
func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
return app.mm.RunMigrations(ctx, app.configurator, fromVM)
})
}
Expand Down
7 changes: 4 additions & 3 deletions app/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import (
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
dbm "github.com/tendermint/tm-db"

"github.com/Finschia/ostracon/libs/log"

"github.com/Finschia/wasmd/x/wasmplus"

"github.com/Finschia/finschia-sdk/baseapp"
"github.com/Finschia/finschia-sdk/simapp"
"github.com/Finschia/finschia-sdk/tests/mocks"
Expand All @@ -38,8 +42,6 @@ import (
"github.com/Finschia/finschia-sdk/x/staking"
tokenmodule "github.com/Finschia/finschia-sdk/x/token/module"
"github.com/Finschia/finschia-sdk/x/upgrade"
"github.com/Finschia/ostracon/libs/log"
"github.com/Finschia/wasmd/x/wasmplus"
)

func TestSimAppExportAndBlockedAddrs(t *testing.T) {
Expand Down Expand Up @@ -125,7 +127,6 @@ func TestRunMigrations(t *testing.T) {
}

for _, tc := range testCases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
var err error

Expand Down
4 changes: 2 additions & 2 deletions app/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (app *LinkApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [

// withdraw all validator commission
app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) {
_, _ = app.DistrKeeper.WithdrawValidatorCommission(ctx, val.GetOperator()) // nolint: errcheck
_, _ = app.DistrKeeper.WithdrawValidatorCommission(ctx, val.GetOperator()) //nolint: errcheck
return false
})

Expand All @@ -86,7 +86,7 @@ func (app *LinkApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [
}
delAddr := sdk.MustAccAddressFromBech32(delegation.DelegatorAddress)

_, _ = app.DistrKeeper.WithdrawDelegationRewards(ctx, delAddr, valAddr) // nolint: errcheck
_, _ = app.DistrKeeper.WithdrawDelegationRewards(ctx, delAddr, valAddr) //nolint: errcheck
}

// clear validator slash events
Expand Down
4 changes: 2 additions & 2 deletions app/genesis_account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import (

"github.com/stretchr/testify/require"

"github.com/Finschia/ostracon/crypto"

"github.com/Finschia/finschia-sdk/crypto/keys/secp256k1"
"github.com/Finschia/finschia-sdk/simapp"
sdk "github.com/Finschia/finschia-sdk/types"
authtypes "github.com/Finschia/finschia-sdk/x/auth/types"
"github.com/Finschia/ostracon/crypto"
)

func TestSimGenesisAccountValidate(t *testing.T) {
Expand Down Expand Up @@ -80,7 +81,6 @@ func TestSimGenesisAccountValidate(t *testing.T) {
}

for _, tc := range testCases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
require.Equal(t, tc.wantErr, tc.sga.Validate() != nil)
})
Expand Down
8 changes: 5 additions & 3 deletions app/wasm_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ package app
import (
"strings"

wasmvmtypes "github.com/Finschia/wasmvm/types"

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

"github.com/Finschia/finschia-sdk/codec"
codectypes "github.com/Finschia/finschia-sdk/codec/types"
sdk "github.com/Finschia/finschia-sdk/types"
sdkerrors "github.com/Finschia/finschia-sdk/types/errors"
wasmkeeper "github.com/Finschia/wasmd/x/wasm/keeper"
wasmtypes "github.com/Finschia/wasmd/x/wasm/types"
wasmvmtypes "github.com/Finschia/wasmvm/types"
)

func filteredStargateMsgEncoders(cdc codec.Codec) *wasmkeeper.MessageEncoders {
Expand Down
10 changes: 5 additions & 5 deletions app/wasm_filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@ package app
import (
"testing"

"github.com/golang/protobuf/proto" // nolint: staticcheck
wasmvmtypes "github.com/Finschia/wasmvm/types"
"github.com/golang/protobuf/proto" //nolint: staticcheck
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

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

codectypes "github.com/Finschia/finschia-sdk/codec/types"
sdk "github.com/Finschia/finschia-sdk/types"
banktypes "github.com/Finschia/finschia-sdk/x/bank/types"
govtypes "github.com/Finschia/finschia-sdk/x/gov/types"
wasmkeeper "github.com/Finschia/wasmd/x/wasm/keeper"
wasmtypes "github.com/Finschia/wasmd/x/wasm/types"
wasmvmtypes "github.com/Finschia/wasmvm/types"
)

func TestFilteredStargateMsgEncoders(t *testing.T) {
Expand Down Expand Up @@ -123,7 +124,6 @@ func TestFilteredStargateMsgEncoders(t *testing.T) {
}
encodingConfig := MakeEncodingConfig()
for name, tc := range cases {
tc := tc
t.Run(name, func(t *testing.T) {
var ctx sdk.Context
encoder := wasmkeeper.DefaultEncoders(encodingConfig.Marshaler, tc.transferPortSource)
Expand Down
11 changes: 7 additions & 4 deletions cli_test/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ import (

"github.com/stretchr/testify/require"

osttypes "github.com/Finschia/ostracon/types"

"github.com/Finschia/finschia-sdk/client/flags"
"github.com/Finschia/finschia-sdk/crypto/keys/ed25519"
sdk "github.com/Finschia/finschia-sdk/types"
"github.com/Finschia/finschia-sdk/types/tx"
gov "github.com/Finschia/finschia-sdk/x/gov/types"
minttypes "github.com/Finschia/finschia-sdk/x/mint/types"
osttypes "github.com/Finschia/ostracon/types"

"github.com/Finschia/finschia/v4/app"
)
Expand Down Expand Up @@ -654,7 +655,7 @@ func TestFnsadSubmitCommunityPoolSpendProposal(t *testing.T) {
defer f.Cleanup()

// create some inflation
var cdc, amino = app.MakeCodecs()
cdc, amino := app.MakeCodecs()
genesisState := f.GenesisState()
inflationMin := sdk.MustNewDecFromStr("10000.0")
var mintData minttypes.GenesisState
Expand Down Expand Up @@ -1040,7 +1041,8 @@ func TestFnsadMultisignSortSignatures(t *testing.T) {

// Multisign, keys in different order
out, err = f.TxMultisign(unsignedTxFile.Name(), keyFooBarBaz, []string{
bazSignatureFile.Name(), fooSignatureFile.Name()})
bazSignatureFile.Name(), fooSignatureFile.Name(),
})
require.NoError(t, err)

// Write the output to disk
Expand Down Expand Up @@ -1101,7 +1103,8 @@ func TestFnsadMultisign(t *testing.T) {

// Multisign
out, err = f.TxMultisign(unsignedTxFile.Name(), keyFooBarBaz, []string{
fooSignatureFile.Name(), barSignatureFile.Name()})
fooSignatureFile.Name(), barSignatureFile.Name(),
})
require.NoError(t, err)

// Write the output to disk
Expand Down
Loading

0 comments on commit 3ba0031

Please sign in to comment.