revelc/formatter-maven-plugin

[jsoup] html parser with <script> and inline javascript calls will add extra lines

Closed this issue · 4 comments

All passes with a <script> tag with content in the block such as <script>doSomething();</script> will cause the jsoup formatter to add a line break incorrectly. This leads to an extra line break on each subsequent pass of the formatter resulting in an ever growing file.

More issues with jsoup formatting in that it adds trailing spaces randomly. We can correct that by using the trailing space remover by force on this one but that alone doesn't fully fix the issue as then

blocks on multiple lines are broken. Will not include test for double pass on this in first go as it appears more work at jsoup needs completed still.

Created 2 new issues here to link to jsoup #539 and #538.

Internally but not pushed, the trailing space issue has been addressed by using recently added logic. We need to rethink trailing spaces in general as I feel we should default that to true as I see no value in trailing whitespace and opt in to fix. If we keep it opt in, then my patch for jsoup just forces it without cause defeating the purpose of shared code. Further, looing at that new logic, we have a problem. If it did not format anything, it fails to even look at trailing spaces and that is technically wrong. It should look regardless as there may be trailing space and no formatting at all done. I'm only noting here due to relationship.

The original issue here is not addressed yet. I only got PRs ready for other two I opened here ready for jsoup to review. I'm not sure if those will take as is or how long it will take for a release. In meantime, I'll take another look at the script issue as it is present even with all these fixes best I could determine thus far.

jsoup upstream has this specific issue fixed on master. Will be adjusting so we use their snapshot on our master temporarily to vet out the various issues already fixed to get us off github vulnerability notice as well as help get that to completion.

resolved in 2.18.0