Skip to content

Commit

Permalink
fully enable revive (#3888)
Browse files Browse the repository at this point in the history
* fully enable revive

* revive

* resolve import shadowing by use of suite as a reciever

* unused-receiver

* names in parse.go

* resolve import shadowing

* resolve import shadowing in all places

* disable flag-return revive linter

* remove all unused receivers

* disable modifies-method-receiver

* unused-rec

* unused-rec

* unused-rec

* unused-parameter

* unused

* remove unused-parameter linter

* Revert "unused-parameter"

This reverts commit 55e6862.

* Revert "unused"

This reverts commit f3f5acf.

* revert a spelling issue caused by using us locale

* don't use unused-parameters

* don't use unused-parameters

* fix a few stragglers and focus in on "return in a defer function"

* interfaces -> any.  Disable early-return and defer in revive for now.

* transfer ibc module

* type params

* revert unneeded changes

* revert unneeded changes

* Revert "lint docs same as docs-lint pr"

This reverts commit 7ea500c.

* fix unused parameters (cleanup)

* restore export.go

* restore mock.go

* resolve linting issues in mock.go

* move interchain accounts tests to ica

* complete cleanup

* cleanup parameters

* cleanup parameters

* suite -> s

* further cleanup

* fully cleaned

* tidy capability

* Update e2e/testvalues/values.go

Co-authored-by: Jim Fasarakis-Hilliard <d.f.hilliard@gmail.com>

* make e2e match main

* make .github match main

* Update modules/core/02-client/migrations/v7/solomachine.go

Co-authored-by: Jim Fasarakis-Hilliard <d.f.hilliard@gmail.com>

* make the e2e folder match main

* remove the test instances accidentally added

* name unused parameters

* don't name something "prefix" when using an import named "prefix"

* use string, string instead of named returns, but keep the naming clarity

* finish consistency

* import suite as testifysuite

* Rename suite to testifysuite, fix references.

* s -> suite for controller module.

* s -> suite for host module.

* s -> suite for fee module, clean up additional host references.

* s -> suite for transfer.

* s -> suite for capability.

* s -> suite for 02-client.

* s -> suite for 03-connection.

* s -> suite, missed cases.

* s -> suite, 04-channel.

* s -> suite, 05-port.

* s -> suite, 23-commitment.

* s -> suite, core.

* s -> suite, light-client solomachine

* s -> suite, light-client tendermint

* s -> suite, light-client localhost

* s -> suite, testing folder

* clean up remaining usages of s.

* Add directives to ignore deprecated event attributes.

* Allow usage of interface{}.

* Fix linting issues after rebase.

* Address new linting issues.

* Revert renaming of args. Requires separate issue.

---------

Co-authored-by: Jim Fasarakis-Hilliard <d.f.hilliard@gmail.com>
Co-authored-by: Cian Hatton <cian@interchain.io>
  • Loading branch information
3 people authored Aug 1, 2023
1 parent 9e97003 commit a4ca39c
Show file tree
Hide file tree
Showing 104 changed files with 406 additions and 372 deletions.
66 changes: 54 additions & 12 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,24 @@ linters:
- nakedret
- staticcheck
- thelper
- typecheck
- stylecheck
- revive
- typecheck
- tenv
- unconvert
- unused
- misspell

issues:
exclude-rules:
- text: 'unused-parameter'
- text: 'differs only by capitalization to method'
linters:
- revive
- text: 'SA1019:'
linters:
- staticcheck
- text: 'Use of weak random number generator'
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

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

Expand All @@ -73,6 +65,56 @@ linters-settings:
require-explanation: false
require-specific: false
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
- name: unhandled-error
disabled: false
arguments:
- 'fmt.Printf'
- 'fmt.Print'
- 'fmt.Println'
- 'myFunction'
7 changes: 3 additions & 4 deletions e2e/tests/core/02-client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ import (
tmtypes "github.com/cometbft/cometbft/types"
tmversion "github.com/cometbft/cometbft/version"
"github.com/cosmos/cosmos-sdk/client/grpc/tmservice"
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
"github.com/strangelove-ventures/interchaintest/v7/chain/cosmos"
"github.com/strangelove-ventures/interchaintest/v7/ibc"
test "github.com/strangelove-ventures/interchaintest/v7/testutil"
"github.com/stretchr/testify/suite"

"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
testifysuite "github.com/stretchr/testify/suite"

govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
paramsproposaltypes "github.com/cosmos/cosmos-sdk/x/params/types/proposal"
Expand All @@ -40,7 +39,7 @@ const (
)

func TestClientTestSuite(t *testing.T) {
suite.Run(t, new(ClientTestSuite))
testifysuite.Run(t, new(ClientTestSuite))
}

type ClientTestSuite struct {
Expand Down
9 changes: 4 additions & 5 deletions e2e/tests/core/03-connection/connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,18 @@ import (

govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
paramsproposaltypes "github.com/cosmos/cosmos-sdk/x/params/types/proposal"
"github.com/strangelove-ventures/interchaintest/v7/ibc"
test "github.com/strangelove-ventures/interchaintest/v7/testutil"
"github.com/stretchr/testify/suite"

"github.com/cosmos/ibc-go/e2e/testsuite"
"github.com/cosmos/ibc-go/e2e/testvalues"
connectiontypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types"
ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported"
ibctesting "github.com/cosmos/ibc-go/v7/testing"
"github.com/strangelove-ventures/interchaintest/v7/ibc"
test "github.com/strangelove-ventures/interchaintest/v7/testutil"
testifysuite "github.com/stretchr/testify/suite"
)

func TestConnectionTestSuite(t *testing.T) {
suite.Run(t, new(ConnectionTestSuite))
testifysuite.Run(t, new(ConnectionTestSuite))
}

type ConnectionTestSuite struct {
Expand Down
11 changes: 5 additions & 6 deletions e2e/tests/interchain_accounts/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ import (
"testing"
"time"

sdk "github.com/cosmos/cosmos-sdk/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/gogoproto/proto"
"github.com/strangelove-ventures/interchaintest/v7"
"github.com/strangelove-ventures/interchaintest/v7/chain/cosmos"
"github.com/strangelove-ventures/interchaintest/v7/ibc"
test "github.com/strangelove-ventures/interchaintest/v7/testutil"
"github.com/stretchr/testify/suite"

sdk "github.com/cosmos/cosmos-sdk/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/gogoproto/proto"
testifysuite "github.com/stretchr/testify/suite"

"github.com/cosmos/ibc-go/e2e/testsuite"
"github.com/cosmos/ibc-go/e2e/testvalues"
Expand All @@ -24,7 +23,7 @@ import (
)

func TestInterchainAccountsTestSuite(t *testing.T) {
suite.Run(t, new(InterchainAccountsTestSuite))
testifysuite.Run(t, new(InterchainAccountsTestSuite))
}

type InterchainAccountsTestSuite struct {
Expand Down
11 changes: 5 additions & 6 deletions e2e/tests/interchain_accounts/gov_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,19 @@ import (
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
"github.com/cosmos/gogoproto/proto"

"github.com/strangelove-ventures/interchaintest/v7"
"github.com/strangelove-ventures/interchaintest/v7/ibc"
test "github.com/strangelove-ventures/interchaintest/v7/testutil"
"github.com/stretchr/testify/suite"

"github.com/cosmos/ibc-go/e2e/testsuite"
"github.com/cosmos/ibc-go/e2e/testvalues"
controllertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types"
icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types"
ibctesting "github.com/cosmos/ibc-go/v7/testing"
"github.com/strangelove-ventures/interchaintest/v7"
"github.com/strangelove-ventures/interchaintest/v7/ibc"
test "github.com/strangelove-ventures/interchaintest/v7/testutil"
testifysuite "github.com/stretchr/testify/suite"
)

func TestInterchainAccountsGovTestSuite(t *testing.T) {
suite.Run(t, new(InterchainAccountsGovTestSuite))
testifysuite.Run(t, new(InterchainAccountsGovTestSuite))
}

type InterchainAccountsGovTestSuite struct {
Expand Down
11 changes: 5 additions & 6 deletions e2e/tests/interchain_accounts/groups_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,15 @@ import (
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
grouptypes "github.com/cosmos/cosmos-sdk/x/group"
"github.com/cosmos/gogoproto/proto"
interchaintest "github.com/strangelove-ventures/interchaintest/v7"
"github.com/strangelove-ventures/interchaintest/v7/ibc"
test "github.com/strangelove-ventures/interchaintest/v7/testutil"
"github.com/stretchr/testify/suite"

"github.com/cosmos/ibc-go/e2e/testsuite"
"github.com/cosmos/ibc-go/e2e/testvalues"
controllertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types"
icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types"
ibctesting "github.com/cosmos/ibc-go/v7/testing"
interchaintest "github.com/strangelove-ventures/interchaintest/v7"
"github.com/strangelove-ventures/interchaintest/v7/ibc"
test "github.com/strangelove-ventures/interchaintest/v7/testutil"
testifysuite "github.com/stretchr/testify/suite"
)

const (
Expand Down Expand Up @@ -53,7 +52,7 @@ const (
)

func TestInterchainAccountsGroupsTestSuite(t *testing.T) {
suite.Run(t, new(InterchainAccountsGroupsTestSuite))
testifysuite.Run(t, new(InterchainAccountsGroupsTestSuite))
}

type InterchainAccountsGroupsTestSuite struct {
Expand Down
11 changes: 5 additions & 6 deletions e2e/tests/interchain_accounts/incentivized_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,20 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/gogoproto/proto"
interchaintest "github.com/strangelove-ventures/interchaintest/v7"
"github.com/strangelove-ventures/interchaintest/v7/ibc"
test "github.com/strangelove-ventures/interchaintest/v7/testutil"
"github.com/stretchr/testify/suite"

"github.com/cosmos/ibc-go/e2e/testsuite"
"github.com/cosmos/ibc-go/e2e/testvalues"
controllertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types"
icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types"
feetypes "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types"
ibctesting "github.com/cosmos/ibc-go/v7/testing"
interchaintest "github.com/strangelove-ventures/interchaintest/v7"
"github.com/strangelove-ventures/interchaintest/v7/ibc"
test "github.com/strangelove-ventures/interchaintest/v7/testutil"
testifysuite "github.com/stretchr/testify/suite"
)

func TestIncentivizedInterchainAccountsTestSuite(t *testing.T) {
suite.Run(t, new(IncentivizedInterchainAccountsTestSuite))
testifysuite.Run(t, new(IncentivizedInterchainAccountsTestSuite))
}

type IncentivizedInterchainAccountsTestSuite struct {
Expand Down
11 changes: 5 additions & 6 deletions e2e/tests/interchain_accounts/intertx_incentivized_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,18 @@ import (

sdk "github.com/cosmos/cosmos-sdk/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/ibc-go/e2e/testvalues"
feetypes "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types"
ibctesting "github.com/cosmos/ibc-go/v7/testing"
intertxtypes "github.com/cosmos/interchain-accounts/x/inter-tx/types"
"github.com/strangelove-ventures/interchaintest/v7"
"github.com/strangelove-ventures/interchaintest/v7/ibc"
test "github.com/strangelove-ventures/interchaintest/v7/testutil"
"github.com/stretchr/testify/suite"

"github.com/cosmos/ibc-go/e2e/testvalues"
feetypes "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types"
ibctesting "github.com/cosmos/ibc-go/v7/testing"
testifysuite "github.com/stretchr/testify/suite"
)

func TestIncentivizedInterTxTestSuite(t *testing.T) {
suite.Run(t, new(IncentivizedInterTxTestSuite))
testifysuite.Run(t, new(IncentivizedInterTxTestSuite))
}

type IncentivizedInterTxTestSuite struct {
Expand Down
11 changes: 5 additions & 6 deletions e2e/tests/interchain_accounts/intertx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ import (
"context"
"testing"

sdk "github.com/cosmos/cosmos-sdk/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
intertxtypes "github.com/cosmos/interchain-accounts/x/inter-tx/types"
"github.com/strangelove-ventures/interchaintest/v7"
"github.com/strangelove-ventures/interchaintest/v7/chain/cosmos"
"github.com/strangelove-ventures/interchaintest/v7/ibc"
test "github.com/strangelove-ventures/interchaintest/v7/testutil"
"github.com/stretchr/testify/suite"

sdk "github.com/cosmos/cosmos-sdk/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
intertxtypes "github.com/cosmos/interchain-accounts/x/inter-tx/types"
testifysuite "github.com/stretchr/testify/suite"

"github.com/cosmos/ibc-go/e2e/testsuite"
"github.com/cosmos/ibc-go/e2e/testvalues"
Expand All @@ -23,7 +22,7 @@ import (
)

func TestInterTxTestSuite(t *testing.T) {
suite.Run(t, new(InterTxTestSuite))
testifysuite.Run(t, new(InterTxTestSuite))
}

type InterTxTestSuite struct {
Expand Down
9 changes: 4 additions & 5 deletions e2e/tests/interchain_accounts/localhost_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,23 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/gogoproto/proto"
"github.com/cosmos/ibc-go/e2e/testsuite"
"github.com/cosmos/ibc-go/e2e/testvalues"
controllertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types"
icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types"
clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
"github.com/cosmos/ibc-go/v7/modules/core/exported"
localhost "github.com/cosmos/ibc-go/v7/modules/light-clients/09-localhost"
ibctesting "github.com/cosmos/ibc-go/v7/testing"
"github.com/stretchr/testify/suite"

"github.com/cosmos/ibc-go/e2e/testsuite"
"github.com/cosmos/ibc-go/e2e/testvalues"
"github.com/strangelove-ventures/interchaintest/v7"
"github.com/strangelove-ventures/interchaintest/v7/ibc"
test "github.com/strangelove-ventures/interchaintest/v7/testutil"
testifysuite "github.com/stretchr/testify/suite"
)

func TestInterchainAccountsLocalhostTestSuite(t *testing.T) {
suite.Run(t, new(LocalhostInterchainAccountsTestSuite))
testifysuite.Run(t, new(LocalhostInterchainAccountsTestSuite))
}

type LocalhostInterchainAccountsTestSuite struct {
Expand Down
7 changes: 3 additions & 4 deletions e2e/tests/interchain_accounts/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,18 @@ import (

govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
paramsproposaltypes "github.com/cosmos/cosmos-sdk/x/params/types/proposal"
"github.com/strangelove-ventures/interchaintest/v7/ibc"
"github.com/stretchr/testify/suite"

"github.com/cosmos/ibc-go/e2e/testsuite"
"github.com/cosmos/ibc-go/e2e/testvalues"
controllertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types"
hosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types"
icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types"
ibctesting "github.com/cosmos/ibc-go/v7/testing"
"github.com/strangelove-ventures/interchaintest/v7/ibc"
testifysuite "github.com/stretchr/testify/suite"
)

func TestInterchainAccountsParamsTestSuite(t *testing.T) {
suite.Run(t, new(InterchainAccountsParamsTestSuite))
testifysuite.Run(t, new(InterchainAccountsParamsTestSuite))
}

type InterchainAccountsParamsTestSuite struct {
Expand Down
7 changes: 3 additions & 4 deletions e2e/tests/transfer/authz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,16 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/authz"
test "github.com/strangelove-ventures/interchaintest/v7/testutil"
"github.com/stretchr/testify/suite"

"github.com/cosmos/ibc-go/e2e/testsuite"
"github.com/cosmos/ibc-go/e2e/testvalues"
transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
ibcerrors "github.com/cosmos/ibc-go/v7/modules/core/errors"
test "github.com/strangelove-ventures/interchaintest/v7/testutil"
testifysuite "github.com/stretchr/testify/suite"
)

func TestAuthzTransferTestSuite(t *testing.T) {
suite.Run(t, new(AuthzTransferTestSuite))
testifysuite.Run(t, new(AuthzTransferTestSuite))
}

type AuthzTransferTestSuite struct {
Expand Down
Loading

0 comments on commit a4ca39c

Please sign in to comment.