-
Notifications
You must be signed in to change notification settings - Fork 48
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 special char usage in cmd line args for Rate Limiting the PRs #776
Conversation
Thanks for the contribution! Unfortunately we can't verify the commit author(s): tok-sfci343 <t***@s***.com>. One possible solution is to add that email to your GitHub account. Alternatively you can change your commits to another email and force push the change. After getting your commits associated with your GitHub account, refresh the status of this Pull Request. |
@@ -75,7 +75,7 @@ public RateLimiter() { | |||
* @see net.sourceforge.argparse4j.inf.Namespace Namespace | |||
*/ | |||
public static RateLimiter getInstance(Namespace ns) { | |||
String rateLimitPRCreation = ns.get(Constants.RATE_LIMIT_PR_CREATION); | |||
String rateLimitPRCreation = ns.get((Constants.RATE_LIMIT_PR_CREATION).replace("-","_")); |
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.
I think the better thing is to use the underscore in the constant string and add a unit test to validate that no char is used in ArgumentParser that will be replaced automatically.
Also, we need to test the changes once again.
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.
What is the error that we are hitting if we don't make this change? Can we change the documentation is error out if invalid chars are passed?
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.
'-' is replaced by '_' by argparse4j ArgumentParser while parsing arguments. so "random-arg val" will be set to random_arg=val in the namespace.
What we are purposing here is
- change the argument using - to use _
- add a unit test to throw the error if someone uses it unintentionally.
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.
I see, so users won't see any difference, it is just how we parse internally?
Codecov Report
@@ Coverage Diff @@
## main #776 +/- ##
=========================================
Coverage 84.40% 84.40%
Complexity 374 374
=========================================
Files 27 27
Lines 1244 1244
Branches 164 164
=========================================
Hits 1050 1050
Misses 157 157
Partials 37 37
|
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.
LGTM
No description provided.