-
Notifications
You must be signed in to change notification settings - Fork 459
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
updateYearWithLatest(false) is ignored/doesn't work #677
Comments
I agree this behavior is surprising, but it's tricky to fix. Here is the diff which is causing the headers to update even though you don't want them to: - * http://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0 Note the two fewer spaces, and the spotless/lib/src/main/java/com/diffplug/spotless/generic/LicenseHeaderStep.java Lines 171 to 172 in f71d911
workaroundFor the files which are being updated and you don't want them to be, use some manual regex work to set the right number of spaces and Better workflow, imoI think the behavior you're reasonably expecting is that the I want to preserve my existing copyright headersI think the right default for Spotless, in every application, is It also keeps the copyright info more accurate - if you have a file which was authored in 2016, but updated in 2020, both of those dates should be in the notice. By updating copyright years to today, but only when a file has changed, you achieve that.
My copyright headers have been sloppy, and I want to preserve their history, but blast them into conformityThen you should use Regardless of the above, I want to preserve variances in authorsIf you want to keep Google and FasterXML in the copyright headers on the two random files, then Spotless' license header step can't help, as of today. It isn't smart enough to parse that out. The fix would be #323, which isn't on my personal roadmap. |
I've thought about this a bit, and it seems like if only the |
We implemented the most permissive thing I could think of. If there's an existing header, it looks for the first two 4-digit years it can find. If it only finds one, it uses that, if it finds two, it uses them like |
Sorry for the delay in circling back to this! Your solution sounds great, thanks for the quick turnaround |
No worries, thanks for telling us about a pain point :) |
When running with
.updateYearWithLatest(false)
on this PR, all the existing copyright headers are updated to 2020 anyway. Is there another configuration we're missing?Spotless version: 0.38.0
macOS 10.15.6
The text was updated successfully, but these errors were encountered: