-
Notifications
You must be signed in to change notification settings - Fork 134
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
License replacement attempts to preserve existing year info #1227
Conversation
Generate changelog in
|
boolean existingHeaderContainsYear = yearInfo.find(); | ||
String year = existingHeaderContainsYear | ||
? yearInfo.group(0) | ||
: String.valueOf(YearMonth.now().getYear()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line is really the money.
the rest of the PR is mainly just me deleting indirection that doesn't seem necessary now that we're not working around spotless' API
Released 3.4.1 |
Thanks @iamdanfox! |
Before this PR
@tusharnarayan got a PR to upgrade baseline on his project and it nuked all his existing license (which were pretty bonkers anyway) and replaced them with 2020 ones. This upsets legal, who prefer to preserve the original creation date of files where possible.
After this PR
==COMMIT_MSG==
Auto-fixing license headers will attempt to preserve the existing year of creation.
==COMMIT_MSG==
I predict this will be incredibly useful when we want to open source an internal project, because we should be able to just swap out the license template it .baseline/copyright and then run
./gradlew format
.Confirming I ran this on tushar's project and it did the right thing.
Possible downsides?