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

chore: rename any var to protoAny #2986

Merged
merged 14 commits into from
Feb 15, 2023
Merged

Conversation

RegisGraptin
Copy link
Contributor

@RegisGraptin RegisGraptin commented Jan 9, 2023

Description

Some variable names are too generic and are not precise in the code. This is the case with some variables named any. A change has been made to rename it protoAny instead.

This modification has been made on the variable names when they were assigned by the functions codectypes.NewAnyWithValue() or clienttypes.PackClientState(). It was partially changed on a previous merge. I do not know if other parts of the code needed to be changed ? Nor the documentation ?

closes: #2890

Commit Message / Changelog Entry

chore: rename any var to protoAny

Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (see CONTRIBUTING.md).
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration tests.
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/).
  • Added relevant godoc comments.
  • Provide a commit message to be used for the changelog entry in the PR description for review.
  • Re-reviewed Files changed in the Github PR explorer.
  • Review Codecov Report in the comment section below once CI passes.

@damiannolan
Copy link
Contributor

Hey @RegisGraptin, thanks for picking up this issue!

I do not know if other parts of the code needed to be changed ? Nor the documentation ?

I think the documentation is probably fine, but I think there is some more occurrences of any used throughout the codebase. E.g. https://github.com/cosmos/ibc-go/blob/main/modules/apps/27-interchain-accounts/host/keeper/relay.go#L68-L71

I ran a simple string search using any, err as it seems to be harder to grep for just any alone as we get more results than desired

@RegisGraptin
Copy link
Contributor Author

RegisGraptin commented Jan 10, 2023

Hey @damiannolan,

Thanks for your reply.
Okay, I will take a look at the other tuples of variables named any, err and modify it. And have a look on other variables with only any.
I didn't know if all the any variables needed to be modified, as they might need to be named differently depending on the function called. Maybe not protoAny but something else. As an example, I found:

clientAny, err := types.PackClientState(tc.clientState)
...
csAny, _ := clienttypes.PackClientState(counterpartyClient)

Do we need to standardized the naming convention for those two ?

@codecov-commenter
Copy link

codecov-commenter commented Jan 11, 2023

Codecov Report

Merging #2986 (692381c) into main (65f7038) will increase coverage by 0.00%.
The diff coverage is 91.66%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2986   +/-   ##
=======================================
  Coverage   78.53%   78.53%           
=======================================
  Files         179      179           
  Lines       12436    12437    +1     
=======================================
+ Hits         9767     9768    +1     
  Misses       2243     2243           
  Partials      426      426           
Impacted Files Coverage Δ
modules/core/02-client/keeper/grpc_query.go 68.33% <75.00%> (ø)
...s/apps/27-interchain-accounts/host/keeper/relay.go 71.08% <100.00%> (ø)
modules/apps/27-interchain-accounts/types/codec.go 79.54% <100.00%> (ø)
...odules/apps/27-interchain-accounts/types/packet.go 81.81% <100.00%> (ø)
modules/core/02-client/types/codec.go 79.59% <100.00%> (ø)
modules/core/02-client/types/proposal.go 87.01% <100.00%> (ø)
modules/core/03-connection/types/msgs.go 85.00% <100.00%> (ø)
modules/core/keeper/msg_server.go 55.17% <100.00%> (+0.09%) ⬆️

@crodriguezvega
Copy link
Contributor

Do we need to standardized the naming convention for those two ?

I would say let's just use the same name (protonAny) everywhere. We can add this to our coding style guide.

@crodriguezvega
Copy link
Contributor

Thanks for the latest updates, @RegisGraptin. Do you think the PR is now ready for review?

@RegisGraptin
Copy link
Contributor Author

Hey @crodriguezvega. Yes, I think it should be good :)

@crodriguezvega crodriguezvega marked this pull request as ready for review February 8, 2023 21:06
Copy link
Contributor

@damiannolan damiannolan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution! ❤️

Copy link
Contributor

@colin-axner colin-axner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @RegisGraptin! Appreciate the time you took to fix this for us!

@crodriguezvega crodriguezvega merged commit 99c985c into cosmos:main Feb 15, 2023
stackman27 pushed a commit to stackman27/ibc-go that referenced this pull request Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rename any to protoAny across the codebase
5 participants