-
Notifications
You must be signed in to change notification settings - Fork 424
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
[#1380] Fix for requiredOptionMarker displayed on ArgGroup #1505
Conversation
(I had a longer overall comment but I can't see it now so let me post it again.) Thank you for this PR! Looking back at the commit for issue #871 that made options in exclusive groups required, it is clear that this solution resulted in a loss of information: it became impossible to determine whether an option was originally marked as I like the approach of this PR to add a field to store the original value of I also like the fact that the PR adds several tests, nice! (Also thanks for the test for #1420, that will be useful when working on that ticket.) Also I noticed that this PR modifies several html files in the I like the approach of this PR, I think it is the correct way to go. |
@remkop somehow I don't see any comments/feedback on code, Can you check? |
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.
@remkop somehow I don't see any comments/feedback on code, Can you check?
I think I lost my comment and then did not press the "Submit review" button so my feedback has been pending all the time... sorry about that.
Hopefully the individual comments will become visible when I click "Submit review" on this comment. Summary of the main items:
- I did have some feedback on the tests to make them smaller and more concise, can you take a look?
- I noticed that this PR modifies several html files in the docs/ folder, can those changes be excluded from this PR?
- I like the approach of this PR, I think it is the correct way to go. One small thing is the naming of the newly added field. Can you take a look at my feedback on that?
qaplug_result.html
Outdated
<font style="font-family:verdana; font-weight:bold; color:#005555; size = 3">Project:</font><br/> <b>picocli</b><br/> <font style="font-family:verdana; font-weight:bold; color:#005555; size = 3">Scope:</font><br/> <b>File '…/picocli-annotation-processing-tests/src/test/java/picocli/Issue1380Test.java [picocli.picocli-annotation-processing-tests.test]'</b><br/> <font style="font-family:verdana; font-weight:bold; color:#005555; size = 3">Profile:</font><br/> <b>Default</b><br/> <font style="font-family:verdana; font-weight:bold; color:#005555; size = 3">Results:</font><br/> <b>Enabled coding rules: 459</b><br/><ul><li>FindBugs: 346</li><li>Checkstyle: 30</li><li>PMD: 83</li></ul> <b>Problems found: 0</b><br/><ul><li>FindBugs: 0</li><li>Checkstyle: 0</li><li>PMD: 0</li></ul><br/> <font style="font-family:verdana; font-weight:bold; color:#005555; size = 3">Time statistics:</font><ul><li>Started: Sun Nov 21 13:09:35 PST 2021</li><ul><li>Initialization: 00:00:00.769</li><li>PMD: 00:00:01.066</li><li>FindBugs: 00:00:01.553</li><li>Checkstyle: 00:00:00.415</li><li>Gathering results: 00:00:00.018</li></ul><li>Finished: Sun Nov 21 13:09:39 PST 2021</li></ul> | ||
<font style="font-family:verdana; font-weight:bold; color:#005555; size = 3">Detailed Results:</font><br/> <b>Empty results</b><br/><ul></ul><br/> | ||
</body> | ||
</html> |
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.
Why is this qaplug_result.html
file necessary?
If this is a report that is generated during the build, should this be added to .gitignore
, or is this something that should be published?
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 was part of my course work, I removed the file.
return this.exclusive; | ||
} | ||
|
||
private static class ExclusiveOptions { |
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.
It seems that the TestingClassExclusiveFalse.ExclusiveOptions
and TestingClassExclusiveTrue.ExclusiveOptions
classes are identical (unless I overlooked something). Maybe we can move ExclusiveOptions
out of those nested classes so we only need one class? (We can rename it to Issue1380ExclusiveOptions
to give it a more unique name.)
/** | ||
* Added getters to satisfy PMF and findBug requirements | ||
*/ | ||
public boolean getSilent() { |
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.
Also, I am not that concerned about PMF and findBug warnings, especially for test code.
I am okay with making fields package protected and removing the getters if the getters are not used anywhere.
Less code makes it easier to read and understand. :-)
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.
that was needed for my course work, removed
/** | ||
* Added getters to satisfy PMF and findBug requirements | ||
*/ | ||
public boolean getVerbose() { |
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.
Similar to the other @Option
-annotated fields (let's make them package protected and remove the unused getters).
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.
removed
@@ -8636,6 +8638,13 @@ void applyInitialValue(Tracer tracer) { | |||
} | |||
} | |||
|
|||
/** Returns whether this is a required option or positional parameter without a default value. |
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.
Let's document that this is the original value of the option's required
value, regardless of whether the option is in an exclusive group or not.
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.
Updated
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.
How about this instead:
"Returns the original value of the option's required
attribute, regardless of whether the option is used in an exclusive group or not."
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.
Updated
@@ -8636,6 +8638,13 @@ void applyInitialValue(Tracer tracer) { | |||
} | |||
} | |||
|
|||
/** Returns whether this is a required option or positional parameter without a default value. | |||
* If this argument is part of a {@linkplain ArgGroup group}, this method returns whether this argument is required <em>within the group</em> (so it is not necessarily a required argument for the command). | |||
* @see Option#optionIsNotRequired() */ |
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.
Let's remove this: there is no @Option.optionIsNotRequired
or @Option.originallyRequired
method on the @Option
annotation. Maybe link to @see OptionSpec#required()
?
Also, since we are adding public API, let's add a @since
tag.
This will be included in the 4.7.0 release, so let's add @since 4.7.0
.
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.
Updated
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.
Updated as requested
Docs folder changes were all whitespaces something from my bad IDE, that is why I had on .gitignore initially |
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.
Thank you for the changes.
I think we are almost there.
One thing: this pull request still contains many modifications to HTML files in the docs/
folder.
I don't want to modify those files.
Can you revert the changes to the HTML files in the docs/
folder?
@@ -8636,6 +8638,13 @@ void applyInitialValue(Tracer tracer) { | |||
} | |||
} | |||
|
|||
/** Returns whether this is a required option or positional parameter without a default value. |
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.
How about this instead:
"Returns the original value of the option's required
attribute, regardless of whether the option is used in an exclusive group or not."
I reverted the docs/ files |
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.
Great, thank you for making the changes.
This looks ready to merge now.
I just need to decide on whether I will do a 4.6.3 release first or not.
I am a bit preoccupied with the Log4j issue at the moment, so this may take some time.
Thank you again for the contribution!
I am seeing the following test failures. Can you take a look?
|
I just rechecked the test and did a clean rebuild (
Looking at the checks I saw these on windows (I don't have a windows machine) (only change is the move of the inner class, Do you want me to put it back retest again?) |
Merged. Thank you for the contribution and for your patience! |
fix for Issue#1380
#1380