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

Throw CommandLineParserInternalException for immutable collections #102

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

Conversation

magicDGS
Copy link
Contributor

Closes #100

@codecov-io
Copy link

codecov-io commented Oct 11, 2017

Codecov Report

Merging #102 into master will increase coverage by 0.1%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff             @@
##             master     #102     +/-   ##
===========================================
+ Coverage     75.68%   75.78%   +0.1%     
- Complexity      576      583      +7     
===========================================
  Files            22       22             
  Lines          2159     2189     +30     
  Branches        447      448      +1     
===========================================
+ Hits           1634     1659     +25     
- Misses          350      351      +1     
- Partials        175      179      +4
Impacted Files Coverage Δ Complexity Δ
...e/barclay/argparser/CommandLineArgumentParser.java 82.58% <100%> (+0.23%) 179 <5> (+3) ⬆️
...titute/barclay/help/DefaultDocWorkUnitHandler.java 72.41% <0%> (-0.16%) 76% <0%> (-1%)
...lay/argparser/LegacyCommandLineArgumentParser.java 75.25% <0%> (ø) 123% <0%> (ø) ⬇️
...n/java/org/broadinstitute/barclay/utils/Utils.java 30.64% <0%> (+14.31%) 10% <0%> (+5%) ⬆️

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 e2320da...43b3c49. Read the comment docs.

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.

A couple of change requests for this one. We might want to factor out some code from setArgument since its getting to be a bit long. If you feel like doing that, should probably do it in a separate commit on top of the code review comment changes. Thanks.

//user specified this arg=null which is interpreted as empty list
c.clear();
} else {
c.add(value);
Copy link
Collaborator

@cmnbroad cmnbroad Oct 27, 2017

Choose a reason for hiding this comment

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

There is at least one other place in this method that calls clear on a collection (line 627). We should scan the code for any places that need to be changed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. I added a method to catch the exception while applying a consumer (either clear/add, but in the future may be others).

final ImmutableCollectionArguments o = new ImmutableCollectionArguments();
new CommandLineArgumentParser(o).parseArguments(System.err, new String[]{"--LIST", "A"});
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

We need to have tests for all combinations of APPEND_TO_COLLECTIONS, "null", and real values.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Added data provider and different combinations.

@magicDGS
Copy link
Contributor Author

@cmnbroad - back to you (this should pass the tests now).

@magicDGS magicDGS force-pushed the dgs_disallow_immutable_collection_args branch from 43b3c49 to 4f2e0c7 Compare November 30, 2017 10:49
@magicDGS
Copy link
Contributor Author

Friendly ping here, @cmnbroad!

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.

3 participants