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

Support author name in LicenseHeaderStep #323

Open
jochenkemnade opened this issue Dec 14, 2018 · 5 comments
Open

Support author name in LicenseHeaderStep #323

jochenkemnade opened this issue Dec 14, 2018 · 5 comments

Comments

@jochenkemnade
Copy link

Some license texts include the name of the file's initial creator. This is currently not possible to do with the LicenseHeaderStep.
Maybe the step could should work with templates rather than constant strings, e,g,

    licenseHeader('/* Copyright ${year} ${author}*/',
                      [year: java.time.LocalDate.now().year, author: 'John Doe'])
@nedtwigg
Copy link
Member

nedtwigg commented Jun 5, 2020

As of plugin-gradle 4.2.1, Spotless can now use git information (ratchetFrom) to only format files which have changed since some previous baseline (e.g. origin/master). This can ensure that license headers stay up-to-date without noisy format-the-world moments.

It could also be used to keep author information up-to-date, for projects where authors are meant to put their name and date in the license header on modification. Enforcing this using ratchetFrom 'origin/master' could fail a PR if the author hasn't added their email to the header, and offer to fix it with spotlessApply. Getting this to work will be tricky, and is not important to me, but if it's important to you, a lot of the necessary infrastructure is now in place.

@nedtwigg
Copy link
Member

nedtwigg commented Jun 5, 2020

@nedtwigg
Copy link
Member

nedtwigg commented Jun 5, 2020

Also related #604.

@jochenberger
Copy link
Contributor

jochenberger commented Nov 3, 2022

I only just noticed that there is a misunderstanding.
This is not about updating the text with the name of the last committer. It's about the initial license creation. My use-case dictates that the initial creator's name be put into the license text and that it stay the same when the license is updated.

@nedtwigg
Copy link
Member

nedtwigg commented Nov 3, 2022

Initial license creation is probably the most popular kind that people want. I know that the Eclipse IDE projects like their heads to include a list of everyone who has worked on the file, with (C) 202x, 202x for each year in which that person worked on it. Happy to take a PR which implements any mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants