Skip to content

Commit

Permalink
chore!: var-naming linter errors (#12135)
Browse files Browse the repository at this point in the history
## Description

This PR works towards #12133 and does a fumpt for consistency once sdk.Int is merged.

The suggested merge order is to begin with sdk.Int, merge in the various linter PR's one by one, and then finally merge the changes to CI from #12134

---

### Author Checklist

*All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.*

I have...

- [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [x] added `!` to the type prefix if API or client breaking change
- [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#pr-targeting))
- [x] provided a link to the relevant issue or specification
- [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/building-modules)
- [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#testing)
- [ ] added a changelog entry to `CHANGELOG.md`
- [ ] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [ ] updated the relevant documentation or specification
- [x] reviewed "Files changed" and left comments if necessary
- [x] confirmed all CI checks have passed

### Reviewers Checklist

*All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.*

I have...

- [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] confirmed `!` in the type prefix if API or client breaking change
- [ ] confirmed all author checklist items have been addressed
- [ ] reviewed state machine logic
- [ ] reviewed API design and naming
- [ ] reviewed documentation is accurate
- [ ] reviewed tests and test coverage
- [ ] manually tested (if applicable)

(cherry picked from commit b7097c3)

# Conflicts:
#	CHANGELOG.md
#	x/group/keeper/keeper.go
  • Loading branch information
faddat authored and mergify[bot] committed Jun 30, 2022
1 parent 9921120 commit c6e4ace
Show file tree
Hide file tree
Showing 8 changed files with 109 additions and 94 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,14 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Bug Fixes

<<<<<<< HEAD
* (x/mint) [#12384](https://github.com/cosmos/cosmos-sdk/pull/12384) Ensure `GoalBonded` must be positive when performing `x/mint` parameter validation.
* (x/auth) [#12261](https://github.com/cosmos/cosmos-sdk/pull/12261) Deprecate pagination in GetTxsEventRequest/Response in favor of page and limit to align with tendermint `SignClient.TxSearch`
* (vesting) [#12190](https://github.com/cosmos/cosmos-sdk/pull/12190) Replace https://github.com/cosmos/cosmos-sdk/pull/12190 to use `NewBaseAccountWithAddress` in all vesting account message handlers.
=======
* (linting) [#12135](https://github.com/cosmos/cosmos-sdk/pull/12135/) Fix variable naming issues per enabled linters. Run gofumpt to ensure easy reviews of ongoing linting work.
* (linting) [#12132](https://github.com/cosmos/cosmos-sdk/pull/12132) Change sdk.Int to math.Int, run `gofumpt -w -l .`, and `golangci-lint run ./... --fix`
>>>>>>> b7097c3b1 (chore!: var-naming linter errors (#12135))
* (cli) [#12127](https://github.com/cosmos/cosmos-sdk/pull/12127) Fix the CLI not always taking into account `--fee-payer` and `--fee-granter` flags.
* (migrations) [#12028](https://github.com/cosmos/cosmos-sdk/pull/12028) Fix v0.45->v0.46 in-place store migrations.
* (baseapp) [#12089](https://github.com/cosmos/cosmos-sdk/pull/12089) Include antehandler and runMsgs events in SimulateTx.
Expand Down
4 changes: 2 additions & 2 deletions x/auth/tx/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ func (s txServer) GetBlockWithTxs(ctx context.Context, req *txtypes.GetBlockWith
"or greater than the current height %d", req.Height, currentHeight)
}

blockId, block, err := tmservice.GetProtoBlock(ctx, s.clientCtx, &req.Height)
blockID, block, err := tmservice.GetProtoBlock(ctx, s.clientCtx, &req.Height)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -236,7 +236,7 @@ func (s txServer) GetBlockWithTxs(ctx context.Context, req *txtypes.GetBlockWith

return &txtypes.GetBlockWithTxsResponse{
Txs: txs,
BlockId: &blockId,
BlockId: &blockID,
Block: block,
Pagination: &pagination.PageResponse{
Total: blockTxsLn,
Expand Down
8 changes: 4 additions & 4 deletions x/authz/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,10 @@ func (keeper Keeper) removeFromGrantQueue(ctx sdk.Context, grantKey []byte, gran
_, _, msgType := parseGrantStoreKey(grantKey)
queueItems := queueItem.MsgTypeUrls

for index, typeUrl := range queueItems {
for index, typeURL := range queueItems {
ctx.GasMeter().ConsumeGas(gasCostPerIteration, "grant queue")

if typeUrl == msgType {
if typeURL == msgType {
end := len(queueItem.MsgTypeUrls) - 1
queueItems[index] = queueItems[end]
queueItems = queueItems[:end]
Expand Down Expand Up @@ -363,8 +363,8 @@ func (k Keeper) DequeueAndDeleteExpiredGrants(ctx sdk.Context) error {

store.Delete(iterator.Key())

for _, typeUrl := range queueItem.MsgTypeUrls {
store.Delete(grantStoreKey(grantee, granter, typeUrl))
for _, typeURL := range queueItem.MsgTypeUrls {
store.Delete(grantStoreKey(grantee, granter, typeURL))
}
}

Expand Down
4 changes: 2 additions & 2 deletions x/group/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,9 @@ func (k Keeper) getVotesByVoter(ctx sdk.Context, voter sdk.AccAddress, pageReque
// TallyResult computes the live tally result of a proposal.
func (k Keeper) TallyResult(goCtx context.Context, request *group.QueryTallyResultRequest) (*group.QueryTallyResultResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
proposalId := request.ProposalId
proposalID := request.ProposalId

proposal, err := k.getProposal(ctx, proposalId)
proposal, err := k.getProposal(ctx, proposalID)
if err != nil {
return nil, err
}
Expand Down
10 changes: 10 additions & 0 deletions x/group/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,13 +391,23 @@ func (k Keeper) TallyProposalsAtVPEnd(ctx sdk.Context) error {
return sdkerrors.Wrap(err, "group")
}

<<<<<<< HEAD
if proposal.Status == group.PROPOSAL_STATUS_ABORTED || proposal.Status == group.PROPOSAL_STATUS_WITHDRAWN {
proposalID := proposal.Id
if err := k.pruneProposal(ctx, proposalID); err != nil {
return err
}
if err := k.pruneVotes(ctx, proposalID); err != nil {
return err
=======
proposalID := proposal.Id
if proposal.Status == group.PROPOSAL_STATUS_ABORTED || proposal.Status == group.PROPOSAL_STATUS_WITHDRAWN {
if err := k.pruneProposal(ctx, proposalID); err != nil {
return true, err
}
if err := k.pruneVotes(ctx, proposalID); err != nil {
return true, err
>>>>>>> b7097c3b1 (chore!: var-naming linter errors (#12135))
}
} else {
err = k.doTallyAndUpdate(ctx, &proposal, electorate, policyInfo)
Expand Down
8 changes: 4 additions & 4 deletions x/group/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,12 @@ func (k Keeper) CreateGroupWithPolicy(goCtx context.Context, req *group.MsgCreat
if err != nil {
return nil, sdkerrors.Wrap(err, "group response")
}
groupId := groupRes.GroupId
groupID := groupRes.GroupId

var groupPolicyAddr sdk.AccAddress
groupPolicyRes, err := k.CreateGroupPolicy(goCtx, &group.MsgCreateGroupPolicy{
Admin: req.Admin,
GroupId: groupId,
GroupId: groupID,
Metadata: req.GroupPolicyMetadata,
DecisionPolicy: req.DecisionPolicy,
})
Expand All @@ -270,7 +270,7 @@ func (k Keeper) CreateGroupWithPolicy(goCtx context.Context, req *group.MsgCreat

if req.GroupPolicyAsAdmin {
updateAdminReq := &group.MsgUpdateGroupAdmin{
GroupId: groupId,
GroupId: groupID,
Admin: req.Admin,
NewAdmin: groupPolicyAddress,
}
Expand All @@ -290,7 +290,7 @@ func (k Keeper) CreateGroupWithPolicy(goCtx context.Context, req *group.MsgCreat
}
}

return &group.MsgCreateGroupWithPolicyResponse{GroupId: groupId, GroupPolicyAddress: groupPolicyAddress}, nil
return &group.MsgCreateGroupWithPolicyResponse{GroupId: groupID, GroupPolicyAddress: groupPolicyAddress}, nil
}

func (k Keeper) CreateGroupPolicy(goCtx context.Context, req *group.MsgCreateGroupPolicy) (*group.MsgCreateGroupPolicyResponse, error) {
Expand Down
4 changes: 2 additions & 2 deletions x/group/keeper/tally.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

// Tally is a function that tallies a proposal by iterating through its votes,
// and returns the tally result without modifying the proposal or any state.
func (k Keeper) Tally(ctx sdk.Context, p group.Proposal, groupId uint64) (group.TallyResult, error) {
func (k Keeper) Tally(ctx sdk.Context, p group.Proposal, groupID uint64) (group.TallyResult, error) {
// If proposal has already been tallied and updated, then its status is
// accepted/rejected, in which case we just return the previously stored result.
//
Expand Down Expand Up @@ -40,7 +40,7 @@ func (k Keeper) Tally(ctx sdk.Context, p group.Proposal, groupId uint64) (group.

var member group.GroupMember
err := k.groupMemberTable.GetOne(ctx.KVStore(k.key), orm.PrimaryKey(&group.GroupMember{
GroupId: groupId,
GroupId: groupID,
Member: &group.Member{Address: vote.Voter},
}), &member)

Expand Down
Loading

0 comments on commit c6e4ace

Please sign in to comment.