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

feat: implement autocli customization #13251

Merged
merged 33 commits into from
Oct 13, 2022
Merged

Conversation

aaronc
Copy link
Member

@aaronc aaronc commented Sep 12, 2022

Description

Ref #11775

This follows up on #11763 and implements the customization options specified there for query commands in client/v2/cli.


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...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • 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 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)

@github-actions github-actions bot added the C:CLI label Sep 12, 2022
@codecov
Copy link

codecov bot commented Sep 12, 2022

Codecov Report

Merging #13251 (d9f3b6a) into main (81d033e) will increase coverage by 0.01%.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #13251      +/-   ##
==========================================
+ Coverage   53.89%   53.90%   +0.01%     
==========================================
  Files         643      643              
  Lines       55464    55464              
==========================================
+ Hits        29891    29897       +6     
+ Misses      23173    23168       -5     
+ Partials     2400     2399       -1     
Impacted Files Coverage Δ
crypto/keys/internal/ecdsa/privkey.go 81.13% <0.00%> (-1.89%) ⬇️
x/group/keeper/keeper.go 56.64% <0.00%> (+0.39%) ⬆️
x/staking/simulation/operations.go 75.91% <0.00%> (+1.37%) ⬆️

@aaronc aaronc marked this pull request as ready for review September 13, 2022 20:56
@aaronc aaronc requested a review from a team as a code owner September 13, 2022 20:56
@amaury1093 amaury1093 self-assigned this Sep 14, 2022
@aaronc aaronc mentioned this pull request Sep 14, 2022
33 tasks
@aaronc
Copy link
Member Author

aaronc commented Sep 27, 2022

Anyone able to review this?

Comment on lines +39 to +41
for _, cmd := range customCmds {
queryCmd.AddCommand(cmd)
}

Check failure

Code scanning / gosec

the value in the range statement should be _ unless copying a map: want: for key := range m

the value in the range statement should be _ unless copying a map: want: for key := range m
Comment on lines +71 to +75
for name := range commandOptions.FlagOptions {
if fields.ByName(protoreflect.Name(name)) == nil {
return nil, fmt.Errorf("can't find field %s on %s specified as a flag", name, messageType.Descriptor().FullName())
}
}

Check failure

Code scanning / gosec

the value in the range statement should be _ unless copying a map: want: for key := range m

got *ast.IfStmt; expected exactly 1 statement (either append or delete) in a range with a map
Comment on lines +22 to +37
for moduleName, modOpts := range moduleOptions {
if customCmds[moduleName] != nil {
// custom commands get added lower down
continue
}

queryCmdDesc := modOpts.Query
if queryCmdDesc != nil {
cmd, err := b.BuildModuleQueryCommand(moduleName, queryCmdDesc)
if err != nil {
return nil, err
}

queryCmd.AddCommand(cmd)
}
}

Check failure

Code scanning / gosec

the value in the range statement should be _ unless copying a map: want: for key := range m

expected exactly 1 statement (either append, delete, or copying to another map) in a range with a map, got 3
list.Append(protoreflect.ValueOfInt64(int64(x)))
}
})
return newListValue(val, func(x uint) protoreflect.Value { return protoreflect.ValueOfUint64(uint64(x)) })

Check failure

Code scanning / gosec

Potential integer overflow by integer type conversion

Potential integer overflow by integer type conversion
@amaury1093
Copy link
Contributor

Anyone able to review this?

I'm taking a look at this, sorry for the delay

Copy link
Contributor

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

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

LGTM! I carefully reviewed the client/v2/cli package and its tests. Also understood the general gist of the flag subpackage, but didn't do a thorough line-by-line review of that package. Good to get merged 👍 pending the small nits/questions below

client/v2/cli/cmd.go Outdated Show resolved Hide resolved
client/v2/cli/query_test.go Show resolved Hide resolved
client/v2/cli/query_test.go Show resolved Hide resolved
client/v2/cli/flag/value.go Outdated Show resolved Hide resolved
@aaronc aaronc mentioned this pull request Oct 10, 2022
@aaronc
Copy link
Member Author

aaronc commented Oct 10, 2022

Addressed all review comments. Okay to merge this?

@aaronc
Copy link
Member Author

aaronc commented Oct 10, 2022

What to do about these gosec warnings? I fail to see how any of them are serious issues

@tac0turtle tac0turtle enabled auto-merge (squash) October 11, 2022 08:33
@aaronc
Copy link
Member Author

aaronc commented Oct 13, 2022

@tac0turtle I think I actually need your ACK here for some reason:
image

@tac0turtle
Copy link
Member

seems tests in the cli/v2 are failing

@tac0turtle tac0turtle merged commit fa2cb40 into main Oct 13, 2022
@tac0turtle tac0turtle deleted the aaronc/autocli-customize branch October 13, 2022 21:25
@aaronc
Copy link
Member Author

aaronc commented Oct 13, 2022

seems tests in the cli/v2 are failing

It was a glitch. So strange

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants