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

fix: add restrictions on the number of args in the CLIs #734

Merged
merged 6 commits into from
Oct 19, 2022

Conversation

0Tech
Copy link
Collaborator

@0Tech 0Tech commented Oct 18, 2022

Description

This patch will add the restrictions on the number of arguments in the CLIs.

Checklist:

  • I followed the contributing guidelines and code of conduct.
  • I have added a relevant changelog to CHANGELOG.md
  • I have added tests to cover my changes.
  • I have updated the documentation accordingly.
  • I have updated API documentation client/docs/swagger-ui/swagger.yaml

@0Tech 0Tech added the A: bug Something isn't working label Oct 18, 2022
@0Tech 0Tech self-assigned this Oct 18, 2022
@codecov
Copy link

codecov bot commented Oct 18, 2022

Codecov Report

Merging #734 (3de2b42) into main (0ade7e4) will increase coverage by 0.04%.
The diff coverage is 96.38%.

❗ Current head 3de2b42 differs from pull request most recent head 143c6c6. Consider uploading reports for the commit 143c6c6 to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #734      +/-   ##
==========================================
+ Coverage   61.95%   62.00%   +0.04%     
==========================================
  Files         875      875              
  Lines       98802    98878      +76     
==========================================
+ Hits        61217    61307      +90     
+ Misses      33983    33962      -21     
- Partials     3602     3609       +7     
Impacted Files Coverage Δ
x/auth/client/cli/query.go 2.13% <0.00%> (-0.02%) ⬇️
x/gov/client/cli/query.go 0.00% <0.00%> (ø)
x/auth/client/testutil/suite.go 96.72% <100.00%> (+0.10%) ⬆️
x/bank/client/testutil/suite.go 99.33% <100.00%> (+0.74%) ⬆️
x/gov/client/testutil/suite.go 100.00% <100.00%> (ø)
x/token/token.go 50.00% <0.00%> (-50.00%) ⬇️
x/token/msgs.go 28.42% <0.00%> (-4.07%) ⬇️
crypto/keys/internal/ecdsa/privkey.go 82.45% <0.00%> (-1.76%) ⬇️
x/collection/msgs.go 40.18% <0.00%> (+3.51%) ⬆️
... and 1 more

@0Tech 0Tech marked this pull request as ready for review October 18, 2022 10:12
Copy link
Contributor

@loin3 loin3 left a comment

Choose a reason for hiding this comment

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

In x/wasm/client/cli/query.go, cobra.ExactArgs(0) is being used.
Is it same with cobra.NoArgs?

x/bank/client/cli/query.go Show resolved Hide resolved
@0Tech
Copy link
Collaborator Author

0Tech commented Oct 19, 2022

In x/wasm/client/cli/query.go, cobra.ExactArgs(0) is being used. Is it same with cobra.NoArgs?

It depends on the meaning of "same". Technically, they are different functions, but both of them throws an error where the number of arguments provided is not empty.

@0Tech 0Tech requested a review from loin3 October 19, 2022 06:09
@@ -94,6 +94,7 @@ $ %s query gov proposal 1
func GetCmdQueryProposals() *cobra.Command {
cmd := &cobra.Command{
Use: "proposals",
Args: cobra.NoArgs,
Copy link
Member

Choose a reason for hiding this comment

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

Do you know why this line is not covered?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In the current testing structure for the CLIs, codecov cannot detect that the code is covered. So I cannot increase the coverage right now. But, actually, the tests DOES cover the CLIs.

CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Contributor

@dudong2 dudong2 left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants