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(client/v2): add autocli run + simapp example #13867

Merged
merged 43 commits into from
Dec 31, 2022
Merged

Conversation

aaronc
Copy link
Member

@aaronc aaronc commented Nov 14, 2022

Description

Closes: #13283

This adds autocli into simd by graceful enhancement. Only commands which are missing a CLI command get an autocli command based on the options provided by a module's HasAutoCLIConfig implementation.

In order to get this to work, I needed some queries that didn't have commands so I made runtime have an actual AppModule implementation and generated commands for it with autocli.

I suggest reviewers manually test this. I was attempting to start a simapp node but ran into issues. If there is a reviewer that would be able to test this against a simapp node that would be greatly appreciated.


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 Nov 14, 2022
client/v2/autocli/run.go Fixed Show fixed Hide fixed
client/v2/autocli/run.go Fixed Show fixed Hide fixed
@codecov
Copy link

codecov bot commented Nov 14, 2022

Codecov Report

Merging #13867 (7da30d6) into main (2739f83) will increase coverage by 0.18%.
The diff coverage is 1.85%.

❗ Current head 7da30d6 differs from pull request most recent head ba15575. Consider uploading reports for the commit ba15575 to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #13867      +/-   ##
==========================================
+ Coverage   56.25%   56.44%   +0.18%     
==========================================
  Files         667      651      -16     
  Lines       56576    56452     -124     
==========================================
+ Hits        31829    31866      +37     
+ Misses      22165    22015     -150     
+ Partials     2582     2571      -11     
Impacted Files Coverage Δ
client/v2/autocli/run.go 0.00% <0.00%> (ø)
client/v2/autocli/validate.go 0.00% <ø> (ø)
client/v2/autocli/query.go 82.06% <25.00%> (ø)
x/auth/keeper/genesis.go 0.00% <0.00%> (-50.00%) ⬇️
x/auth/keeper/account.go 53.33% <0.00%> (-18.34%) ⬇️
x/group/internal/math/dec.go 41.53% <0.00%> (-7.00%) ⬇️
x/gov/abci.go 90.29% <0.00%> (-6.86%) ⬇️
server/config/config.go 69.87% <0.00%> (-2.65%) ⬇️
x/nft/keeper/grpc_query.go 69.38% <0.00%> (-1.45%) ⬇️
x/nft/client/cli/query.go 61.72% <0.00%> (-0.72%) ⬇️
... and 57 more

client/v2/autocli/run.go Fixed Show fixed Hide fixed
client/v2/autocli/run.go Fixed Show fixed Hide fixed
@sonarcloud
Copy link

sonarcloud bot commented Nov 30, 2022

[cosmos-sdk-client-v2] SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

2.9% 2.9% Coverage
0.0% 0.0% Duplication

Comment on lines +35 to +37
for moduleName := range customCmds {
allModuleNames[moduleName] = true
}

Check failure

Code scanning / gosec

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

expected either an append, delete, or copy to another map in a range with a map
Comment on lines +32 to +34
for moduleName := range moduleOptions {
allModuleNames[moduleName] = true
}

Check failure

Code scanning / gosec

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

expected either an append, delete, or copy to another map in a range with a map
@aaronc aaronc marked this pull request as ready for review December 14, 2022 18:59
@julienrbrt
Copy link
Member

tACK (the runtime command), because EnhanceQueryCommand does not overwrite command there is no so much else to see I think.

baseapp/util_test.go Outdated Show resolved Hide resolved
@julienrbrt
Copy link
Member

Once this is merged I'll submit another PR to bump cosmossdk.io/client/v2 to a commit version and delete the replaces.

@sonarcloud
Copy link

sonarcloud bot commented Dec 20, 2022

[Cosmos SDK] Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 6 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@julienrbrt julienrbrt removed the backport/v0.47.x PR scheduled for inclusion in the v0.47's next stable release label Dec 21, 2022
@julienrbrt julienrbrt mentioned this pull request Dec 30, 2022
19 tasks
@julienrbrt julienrbrt enabled auto-merge (squash) December 31, 2022 01:14
@sonarcloud
Copy link

sonarcloud bot commented Dec 31, 2022

[Cosmos SDK - SimApp] Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@julienrbrt julienrbrt merged commit ebfd057 into main Dec 31, 2022
@julienrbrt julienrbrt deleted the aaronc/autocli-simapp branch December 31, 2022 01:53
larry0x pushed a commit to larry0x/cosmos-sdk that referenced this pull request May 22, 2023
Co-authored-by: Julien Robert <julien@rbrt.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AutoCLI app command generation
3 participants