-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add @DeprecatedFeature annotation. #187
Conversation
Codecov ReportBase: 76.66% // Head: 76.69% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #187 +/- ##
============================================
+ Coverage 76.66% 76.69% +0.02%
- Complexity 744 762 +18
============================================
Files 32 33 +1
Lines 2576 2609 +33
Branches 498 505 +7
============================================
+ Hits 1975 2001 +26
- Misses 406 409 +3
- Partials 195 199 +4
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
@droazen I can't recall any reason why this was left as draft. I think its ready for review. |
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.
@cmnbroad A few minor comments.
public String getArgumentUsage(final int argumentColumnWidth, final int descriptionColumnWidth) { | ||
|
||
final StringBuilder sb = new StringBuilder(); | ||
sb.append("--").append("POSITIONAL"); |
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 this include which position it should be in? Is that easy to find? I
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.
Not sure how to convey it, but positional args must always be first. But these are hardly ever used.
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 updated this String to say "POSITIONAL (must be first)"
.
* return true if this argument has the {@code @Deprecated} annotation. | ||
* @return true if this argument is advanced, otherwise false. | ||
*/ | ||
public boolean isDeprecated() { return getUnderlyingField().isAnnotationPresent(Deprecated.class); } |
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.
So previously this would be triggered by the standard java Deprecated
annotation? Should we continue to respect those as well? I don't remember why exactly we decided to use a separate annotation instead of the default one. So that intellij doesn't tag uses of it?
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.
The old code was carried over from the GATK3 implementation, but never fully embraced, and only worked for args IIRC (not tools or other documented features). I think we used a custom annotation both for the IntelliJ issue, and also because we wanted to be able to specify a reason/detail string, which the Java annotation doesn't have. There are a couple of usages of the old tag in GATK for arguments, but I'd prefer to update them rather than carry around (and test) both annotations.
Utils.printSpaces(sb, numSpaces); | ||
|
||
String description = getArgumentDescription(); | ||
if (isDeprecated()) { |
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 this little decorator be factored out so it isn't repeated? Might make it more consistent if we change things in the future.
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.
Done - factored out this decorator plus another method to format the description since that was also duplicated on two places.
this.options = options; | ||
@SuppressWarnings("unchecked") | ||
public GSONArgument(final Map<String, Object> argMap) { | ||
this.summary = argMap.get("summary").toString(); |
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.
Moving this here seems like an improvement.
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.
@cmnbroad Looks good, one nitpick abut the positionals still, feel free to merge and we cacn always address that later
public String getArgumentUsage(final int argumentColumnWidth, final int descriptionColumnWidth) { | ||
|
||
final StringBuilder sb = new StringBuilder(); | ||
sb.append("--").append("POSITIONAL (must be first)"); |
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 hate to be a pain about this, what happens if there are multiple positional arguments?
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.
@lbergelson There can only be one "positional" option per CLP. It can be a collection, so it can have multiple values, but they have to be first in the list. Its basically just an arg without a name. We should probably just get rid of it, but GATK and Picard each have one, I think.
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.
Huh, I thought we supported multiple positionals, sorry, ignore my comment then.
592caf7
to
89b9f4c
Compare
Sorry @lbergelson, I had to add one more commit based on testing with GATK. I messed up the command line display formatting when I factored out display code in this PR, which shows up spectacularly in GATK. We were outputting this: |
@cmnbroad Ugh, good catch. Formatting things is hard. |
@cmnbroad Good to merge. |
Thanks @lbergelson! |
This also fixes an issue where positional args were previously not showing up in command line help.