Skip to content

Commit

Permalink
Fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
fernandofcampos committed Aug 17, 2024
1 parent cc1056a commit 429b05f
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 11 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ on:
branches:
- main
- dev
- release-*
pull_request:

permissions:
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
# pull-requests: read
# Optional: allow write access to checks to allow the action to annotate code in the PR.
checks: write

jobs:
golangci:
Expand All @@ -23,4 +24,4 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.59
version: v1.60.1
2 changes: 0 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ issues:
- linters:
- stylecheck
text: "ST1005:" # punctuation in error messages

#lint:ignore SA1019 deprecated code breaking unit tests
- linters:
- staticcheck
text: "SA1019: \"github.com/cosmos/ibc-go/v8/modules/core/02-client/types\" is deprecated`"
Expand Down
4 changes: 2 additions & 2 deletions x/emissions/keeper/inference_synthesis/network_inferences.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func GetNetworkInferences(
}
} else {
inferences, err = k.GetInferencesAtBlock(ctx, topicId, *inferencesNonce)
inferenceBlockHeight = int64(*inferencesNonce)
inferenceBlockHeight = *inferencesNonce
if err != nil || len(inferences.Inferences) == 0 {
return nil, nil, nil, nil, inferenceBlockHeight, lossBlockHeight, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "no inferences found for topic %v at block %v", topicId, *inferencesNonce)
}
Expand All @@ -70,7 +70,7 @@ func GetNetworkInferences(
}

// Retrieve forecasts
forecasts, err := k.GetForecastsAtBlock(ctx, topicId, BlockHeight(inferenceBlockHeight))
forecasts, err := k.GetForecastsAtBlock(ctx, topicId, inferenceBlockHeight)
if err != nil {
if errors.Is(err, collections.ErrNotFound) {
forecasts = &emissions.Forecasts{
Expand Down
2 changes: 1 addition & 1 deletion x/emissions/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,7 @@ func (k *Keeper) GetLatestNetworkLossBundle(ctx context.Context, topicId TopicId
return &keyValue.Value, nil
}

return nil, nil
return nil, types.ErrNoNetworkLossBundleFound
}

/// STAKING
Expand Down
2 changes: 1 addition & 1 deletion x/emissions/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1311,7 +1311,7 @@ func (s *KeeperTestSuite) TestGetLatestNetworkLossBundle() {

// Initially, there should be no loss bundle, so we expect a zero result
emptyLossBundle, err := keeper.GetLatestNetworkLossBundle(ctx, topicId)
s.Require().NoError(err, "Retrieving latest network loss bundle when none exist should not result in an error")
s.Require().ErrorIs(err, types.ErrNoNetworkLossBundleFound)
s.Require().Nil(emptyLossBundle, "Expected no network loss bundle initially")

// Insert first network loss bundle
Expand Down
4 changes: 2 additions & 2 deletions x/mint/keeper/query_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ func (q queryServer) EmissionInfo(ctx context.Context, _ *types.QueryEmissionInf
sdkCtx := sdk.UnwrapSDKContext(ctx)
blockHeight := uint64(sdkCtx.BlockHeight())
numberOfRecalcs := blockHeight / blocksPerMonth
blockHeightTarget_e_i_LastCalculated := numberOfRecalcs*blocksPerMonth + 1
blockHeightTarget_e_i_Next := blockHeightTarget_e_i_LastCalculated + blocksPerMonth
blockHeightTarget_e_i_LastCalculated := numberOfRecalcs*blocksPerMonth + 1 //nolint:revive // var-naming: don't use underscores in Go names
blockHeightTarget_e_i_Next := blockHeightTarget_e_i_LastCalculated + blocksPerMonth //nolint:revive // var-naming: don't use underscores in Go names

networkStakedTokens, err := GetNumStakedTokens(ctx, q.k)
if err != nil {
Expand Down

0 comments on commit 429b05f

Please sign in to comment.