-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
refactor: refactoring Narg checks #12814
base: master
Are you sure you want to change the base?
Conversation
@ameeetgaikwad I think we need to be a bit more complete with this, have a look for instances of |
I'll go further deep into it! |
@ameeetgaikwad as per my latest comments, could you do a quick scan over your edits and double-check that you're not editing ones that can take >=X args rather than just ==X |
@rvagg so I shouldn't be editing >=X or <=X args right? only the one which has ==X. Is that correct? |
cli/multisig.go
Outdated
@@ -399,7 +403,7 @@ var msigProposeCmd = &cli.Command{ | |||
}, | |||
}, | |||
Action: func(cctx *cli.Context) error { | |||
if cctx.NArg() < 3 { | |||
if cctx.NArg() != 3 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check the block directly below this, this command has a bit of nuance, let's just leave it alone
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should I replace the showHelp
with IncorrectNumArgsWithHint
the one we wrote above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, this one's got too much nuance, leave multisig.go alone, it's got fairly sophisticated handling already
cli/multisig.go
Outdated
@@ -521,7 +525,7 @@ var msigApproveCmd = &cli.Command{ | |||
}, | |||
}, | |||
Action: func(cctx *cli.Context) error { | |||
if cctx.NArg() < 2 { | |||
if cctx.NArg() != 2 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto, but there's 2 more blocks below here; so these commands already strictly check their number of arguments, they just have nuance to the way they report the misuse, let's leave it alone
cli/multisig.go
Outdated
@@ -658,7 +662,7 @@ var msigCancelCmd = &cli.Command{ | |||
}, | |||
}, | |||
Action: func(cctx *cli.Context) error { | |||
if cctx.NArg() < 2 { | |||
if cctx.NArg() != 2 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and again, there's 2 blocks below this that handle other cases up to 6 arguments, let's leave it alone
I have some doubts regarding some comments. I have mentioned them. Also let me know if I have missed some scope of this refactor. I'll refactor those folders as well |
Related Issues
#12790
Proposed Changes
Additional Info
Checklist
Before you mark the PR ready for review, please make sure that: