-
Notifications
You must be signed in to change notification settings - Fork 362
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
Indexed tuple validation #310
Conversation
Codecov Report
@@ Coverage Diff @@
## master #310 +/- ##
==========================================
- Coverage 100% 99.96% -0.04%
==========================================
Files 12 12
Lines 3002 2995 -7
==========================================
- Hits 3002 2994 -8
- Misses 0 1 +1
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #310 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 12 12
Lines 3017 3028 +11
=====================================
+ Hits 3017 3028 +11
Continue to review full report at Codecov.
|
remove restrictions on tuple size, and add some additional tests and modified documentation fix some issues with the negative number check add some test for indexed validation on tuple allow specific validators for specific elements in a type with multiple values, or to just apply to the last given argument
f44a065
to
b7b2bb7
Compare
if(detail::split_short(current, dummy1, dummy2)) { | ||
if(dummy1[0] >= '0' && dummy1[0] <= '9') { | ||
if(get_option_no_throw(std::string{'-', dummy1[0]}) == nullptr) { | ||
return detail::Classifier::NONE; |
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.
This fixes a bug mentioned earlier that -N can match when it should be a number, correct?
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.
yes it should fix the bug mentioned here
@@ -113,7 +115,13 @@ class Validator { | |||
non_modifying_ = no_modify; | |||
return *this; | |||
} | |||
|
|||
/// Specify the application index of a validator | |||
Validator &application_index(int app_index) { |
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.
Could a const copying version work? This currently cannot be applied inline without changing the validator.
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 suppose the same is true for any of the validator modification functions. active
, name
,description
,non_modifying
. I think we would want them all to have the same paradigm.
It would add a number of overloads but might make the calling a little easier for many of the const objects, which require an extra CLI::Validator( ) around them. I will make that change tomorrow morning.
not sure why codacy isn't analyzing things? |
If merged this PR will remove the restrictions on tuple size, and add an index to validators to allow them to apply to specific components of a tuple type or vector type.
it should address #296