-
Notifications
You must be signed in to change notification settings - Fork 472
How to enable linebreak between license header and delimiter #2186
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
Comments
Can you please share your code where you've defined |
Here it is an example https://github.com/datafaker-net/datafaker/blob/ba65ca925835a1834010bae7c4c36e09ef1d94db/pom.xml#L242-L253 |
I think it might be because the XML parsing is trimming "meaningless" trailing newlines. If you specify a license file instead of an inline constant, then it should respect the newline. |
Why was this closed? Using a license file is a workaround, not a solution. The default behavior here for license generation actually breaks a Checkstyle default code smell for "'package' should be separate from previous line". |
To the best of my knowledge, this is a limitation of XML, there is no way to have significant trailing whitespace. So the workaround is the best we can do. Happy to merge a PR that fixes this some other way, but I am betting against such a PR being possible. |
What about using |
I would argue that the extra newline should be added by default. And/or perhaps adding a new option to include an extra newline? <licenseHeader> <!-- specify either content or file, but not both -->
<content>/* (C)$YEAR */</content> <!-- or <file>${project.basedir}/license-header</file> -->
<delimiter>#</delimiter> <!-- content until first occurrence of the delimiter regex will be interpreted as header section -->
<extraNewline>true</extraNewline> <!-- always include an extra newline between header section and delimiter -->
</licenseHeader>
`` |
Perhaps, but we aren't going to make a breaking change for this.
Seems like that would work, good idea! That should probably be the real answer.
My #1 goal is to help people enforce whatever rules they want, my #2 rule is to maintain as few features as possible to make that possible. We have at least 1, possibly 2 (if CDATA works) solutions to this problem. They use the public API in exactly the way it is meant to be used, so I don't think they are "workarounds". If you really want |
Uh oh!
There was an error while loading. Please reload this page.
we are using maven (3.8.6+)
and spotless maven plugin 2.33.0
The configuration looks like
Where
${spotless.delimiter}
is justpackage
The problem is that
after applying it looks like
and we want to have a line break between the license and
package
like
an attempt to insert extra line breaks into LICENSE doesn't help.
Is there a way to make it possible?
The text was updated successfully, but these errors were encountered: