Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update golangci-lint configuration #914

Merged
merged 2 commits into from
May 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,11 @@ linters:
- unconvert
- unused





issues:
gofumpt:
# Module path which contains the source code being formatted.
# Default: ""
module-path: github.com/cosmos/interchain-security
# Choose whether to use the extra rules.
# Default: false
extra-rules: true
exclude-rules:
- text: "Use of weak random number generator"
linters:
Expand All @@ -63,6 +60,10 @@ issues:
max-same-issues: 10000

linters-settings:
gofumpt:
# Choose whether to use the extra rules.
# Default: false
extra-rules: true
gocritic:
disabled-checks:
- appendAssign
Expand Down
4 changes: 2 additions & 2 deletions tests/difference/core/driver/core_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (s *CoreSuite) delegatorBalance() int64 {
}

// delegate delegates amt tokens to validator val
func (s *CoreSuite) delegate(val int64, amt int64) {
func (s *CoreSuite) delegate(val, amt int64) {
server := stakingkeeper.NewMsgServerImpl(s.providerStakingKeeper())
coin := sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(amt))
d := s.delegator()
Expand All @@ -163,7 +163,7 @@ func (s *CoreSuite) delegate(val int64, amt int64) {
}

// undelegate undelegates amt tokens from validator val
func (s *CoreSuite) undelegate(val int64, amt int64) {
func (s *CoreSuite) undelegate(val, amt int64) {
server := stakingkeeper.NewMsgServerImpl(s.providerStakingKeeper())
coin := sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(amt))
d := s.delegator()
Expand Down
4 changes: 2 additions & 2 deletions tests/difference/core/driver/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ func (b *Builder) setSigningInfos() {
// Checks that the lexicographic ordering of validator addresses as computed in
// the staking module match the ordering of validators in the model.
func (b *Builder) ensureValidatorLexicographicOrderingMatchesModel() {
check := func(lesser sdk.ValAddress, greater sdk.ValAddress) {
check := func(lesser, greater sdk.ValAddress) {
lesserV, _ := b.providerStakingKeeper().GetValidator(b.providerCtx(), lesser)
greaterV, _ := b.providerStakingKeeper().GetValidator(b.providerCtx(), greater)
lesserKey := stakingtypes.GetValidatorsByPowerIndexKey(lesserV, sdk.DefaultPowerReduction)
Expand Down Expand Up @@ -525,7 +525,7 @@ func (b *Builder) createConsumerGenesis(client *ibctmtypes.ClientState) *consume
func GetZeroState(
suite *suite.Suite,
initState InitState,
) (path *ibctesting.Path, addrs []sdk.ValAddress, heightLastCommitted int64, timeLastCommitted int64) {
) (path *ibctesting.Path, addrs []sdk.ValAddress, heightLastCommitted, timeLastCommitted int64) {
b := Builder{initState: initState, suite: suite}

b.createProviderAndConsumer()
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,7 @@ func (tr TestRun) invokeDowntimeSlash(action downtimeSlashAction, verbose bool)
}

// Sets validator downtime by setting the virtual ethernet interface of a node to "up" or "down"
func (tr TestRun) setValidatorDowntime(chain chainID, validator validatorID, down bool, verbose bool) {
func (tr TestRun) setValidatorDowntime(chain chainID, validator validatorID, down, verbose bool) {
var lastArg string
if down {
lastArg = "down"
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func delegateAndUndelegate(s *CCVTestSuite, delAddr sdk.AccAddress, bondAmt sdk.
// Note: This function advances blocks in-between operations, where validator powers are
// not checked, since they are checked in integration tests.
func delegateAndRedelegate(s *CCVTestSuite, delAddr sdk.AccAddress,
srcValAddr sdk.ValAddress, dstValAddr sdk.ValAddress, amount sdk.Int,
srcValAddr, dstValAddr sdk.ValAddress, amount sdk.Int,
) {
// Delegate to src validator
srcValTokensBefore := s.getVal(s.providerCtx(), srcValAddr).GetBondedTokens()
Expand Down Expand Up @@ -284,7 +284,7 @@ func incrementTimeByUnbondingPeriod(s *CCVTestSuite, chainType ChainType) {
incrementTime(s, jumpPeriod)
}

func checkStakingUnbondingOps(s *CCVTestSuite, id uint64, found bool, onHold bool, msgAndArgs ...interface{}) {
func checkStakingUnbondingOps(s *CCVTestSuite, id uint64, found, onHold bool, msgAndArgs ...interface{}) {
stakingUnbondingOp, wasFound := getStakingUnbondingDelegationEntry(s.providerCtx(), s.providerApp.GetTestStakingKeeper(), id)
s.Require().Equal(
found,
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ type CCVTestSuite struct {

// NewCCVTestSuite returns a new instance of CCVTestSuite, ready to be tested against using suite.Run().
func NewCCVTestSuite[Tp testutil.ProviderApp, Tc testutil.ConsumerApp](
providerAppIniter ibctesting.AppIniter, consumerAppIniter ibctesting.AppIniter, skippedTests []string,
providerAppIniter, consumerAppIniter ibctesting.AppIniter, skippedTests []string,
) *CCVTestSuite {
ccvSuite := new(CCVTestSuite)

Expand Down
2 changes: 1 addition & 1 deletion x/ccv/consumer/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func ParamKeyTable() paramtypes.KeyTable {
// NewParams creates new consumer parameters with provided arguments
func NewParams(enabled bool, blocksPerDistributionTransmission int64,
distributionTransmissionChannel, providerFeePoolAddrStr string,
ccvTimeoutPeriod time.Duration, transferTimeoutPeriod time.Duration,
ccvTimeoutPeriod, transferTimeoutPeriod time.Duration,
consumerRedistributionFraction string, historicalEntries int64,
consumerUnbondingPeriod time.Duration, softOptOutThreshold string,
) Params {
Expand Down
4 changes: 2 additions & 2 deletions x/ccv/provider/keeper/proposal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func TestCreateConsumerClient(t *testing.T) {
//
// Note: Separated from TestCreateConsumerClient to also be called from TestCreateConsumerChainProposal.
func testCreatedConsumerClient(t *testing.T,
ctx sdk.Context, providerKeeper providerkeeper.Keeper, expectedChainID string, expectedClientID string,
ctx sdk.Context, providerKeeper providerkeeper.Keeper, expectedChainID, expectedClientID string,
) {
t.Helper()
// ClientID should be stored.
Expand Down Expand Up @@ -574,7 +574,7 @@ func TestStopConsumerChain(t *testing.T) {

// testProviderStateIsCleaned executes test assertions for the proposer's state being cleaned after a stopped consumer chain.
func testProviderStateIsCleaned(t *testing.T, ctx sdk.Context, providerKeeper providerkeeper.Keeper,
expectedChainID string, expectedChannelID string,
expectedChainID, expectedChannelID string,
) {
t.Helper()
_, found := providerKeeper.GetConsumerClientId(ctx, expectedChainID)
Expand Down