Skip to content
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

Disable "null..." comment in primitive types #118

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

yfarjoun
Copy link
Contributor

  • Removed note "This option can be set to 'null' to clear the default value." for primitive types.
  • Added a test to show that it works
  • Made sure that there's at least one space between arguments and description

@codecov-io
Copy link

codecov-io commented Dec 10, 2017

Codecov Report

Merging #118 into master will increase coverage by 0.13%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #118      +/-   ##
============================================
+ Coverage     75.69%   75.83%   +0.13%     
- Complexity      580      584       +4     
============================================
  Files            22       22              
  Lines          2181     2181              
  Branches        449      449              
============================================
+ Hits           1651     1654       +3     
  Misses          351      351              
+ Partials        179      176       -3
Impacted Files Coverage Δ Complexity Δ
...lay/argparser/LegacyCommandLineArgumentParser.java 75.88% <100%> (+0.62%) 127 <0> (+4) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b14693a...f3d3d34. Read the comment docs.

@@ -644,7 +644,7 @@ private void printOptionParamUsage(final StringBuilder sb, final String name, fi
}

int numSpaces = OPTION_COLUMN_WIDTH - optionLabel.length();
if (optionLabel.length() > OPTION_COLUMN_WIDTH) {
if (optionLabel.length() > OPTION_COLUMN_WIDTH - 1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this only happen in the legacy parser? I guess that for concordance, it should be modified in the CommandLineArgumentParser

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make this change in the other parser as well ?

@@ -672,7 +672,7 @@ private String makeOptionDescription(final OptionDefinition optionDefinition) {
sb.append("Default value: ");
sb.append(optionDefinition.defaultValue);
sb.append(". ");
if (!optionDefinition.defaultValue.equals("null")) {
if (!optionDefinition.defaultValue.equals("null") && !optionDefinition.field.getType().isPrimitive() ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line does not appear in the CommandLineArgumentParser implementation. Is it better to remove from here too?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other parser does allow "null" for optional args. There are some tests there for it, but please make the same change to check for isPrimitive and add the same usage test there as well.

@yfarjoun
Copy link
Contributor Author

yfarjoun commented Dec 11, 2017 via email

@yfarjoun
Copy link
Contributor Author

@cmnbroad when you have a moment...

Copy link
Collaborator

@cmnbroad cmnbroad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes seem fine, but please propagate them to the other parser we well. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants