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

Wraps text in preamble as well #110

Merged
merged 2 commits into from
Dec 12, 2017
Merged

Wraps text in preamble as well #110

merged 2 commits into from
Dec 12, 2017

Conversation

yfarjoun
Copy link
Contributor

- fixes #103
- also adds some finals and other easthetics
@yfarjoun yfarjoun requested a review from cmnbroad October 28, 2017 09:48
@codecov-io
Copy link

codecov-io commented Oct 28, 2017

Codecov Report

Merging #110 into master will increase coverage by 0.22%.
The diff coverage is 88.46%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #110      +/-   ##
============================================
+ Coverage     76.01%   76.24%   +0.22%     
- Complexity      583      599      +16     
============================================
  Files            22       22              
  Lines          2172     2277     +105     
  Branches        450      492      +42     
============================================
+ Hits           1651     1736      +85     
- Misses          343      356      +13     
- Partials        178      185       +7
Impacted Files Coverage Δ Complexity Δ
...n/java/org/broadinstitute/barclay/utils/Utils.java 30.64% <100%> (ø) 10 <1> (ø) ⬇️
...lay/argparser/LegacyCommandLineArgumentParser.java 75.25% <100%> (ø) 123 <0> (ø) ⬇️
...e/barclay/argparser/CommandLineArgumentParser.java 82.38% <85%> (+0.02%) 176 <0> (ø) ⬇️
...titute/barclay/help/DefaultDocWorkUnitHandler.java 75.84% <0%> (+1.51%) 95% <0%> (+16%) ⬆️

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 4c9bd86...a23b854. 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 minor requests. Thx.

}
} catch (IOException e) {
throw new RuntimeException("Unreachable Statement.\nHow did the Buffered reader throw when it was " +
"wrapping a StringReader?", e);
}

//unless the original string ends in a newline, we need to remove the last newline that was added.
if (input.charAt(input.length() - 1) != '\n') {
out.deleteCharAt(out.length() - 1);
if (input.charAt(input.length() - 1) == '\n') {
Copy link
Collaborator

Choose a reason for hiding this comment

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

The comment above is out of sync with this code now.

out.append("\n");
} else {
break;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Most of the code in these files isn't written in functional style, but this whole statement block could be reduced to:

out.append(bufReader.lines()
    .map(line -> WordUtils.wrap(line, width))
    .collect(Collectors.joining("\n")));

"characters...";

final String result = byteArrayOutputStream.toString();
Assert.assertEquals(result.substring(0, expected.length()), expected);
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

If both parsers were going to live forever, we'd probably invest in refactoring to share test cases, but for now, please duplicate this test for CommandLineParserTest, since since both were modified.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmmm. I tried doing that but the inverse html doesn't seem to work in nonLegacy...am I doing something wrong?

Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks like non legacy parser doesn't do the html->text rendering that the legacy parser does. I added a created #112 for this. Hopefully that won't block adding the test.

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

@yfarjoun
Copy link
Contributor Author

yfarjoun commented Nov 14, 2017 via email

@yfarjoun
Copy link
Contributor Author

back to you @cmnbroad

@yfarjoun
Copy link
Contributor Author

bump.

@cmnbroad cmnbroad merged commit 0c61837 into master Dec 12, 2017
@cmnbroad cmnbroad deleted the yf_wordwrap_the_preamble branch December 12, 2017 13:53
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.

WordWrap the preamble, not only the argument description.
3 participants