mathieucarbou / license-maven-plugin

Manage license headers in your source files

Home Page:https://oss.carbou.me/license-maven-plugin/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add feature to ignore certain commits

philippn opened this issue · comments

Hi there,

First of all: thanks for this great plugin, it's been really helpful to me.

Now here is a feature request that would help me great deal: Suppose we have a large scale old project that is a few years old. So last year, I have run your plugin to cleanup the headers for all those files, that worked nicely. However, ocassionally, new files are added to the repository, that are also missing headers. But when I run the plugin again, the one commit that was performed for adding the license headers is also detected, so basically all the dates get updated again -- to the last year now.

In order to mitigate this, I would propose to integrate a new switch where you can basically pass a Set of commit ids to ignore.

I have also implemented this in a feature branch (see https://github.com/philippn/license-maven-plugin/commit/0e1f7adf751ca8a0da482672d7f2af630a943c01 for details). If you find this a useful addition, I would be happy to provide a pull request.

Thanks again and kind regards,
Philipp

Took a quick look, and I think it's a decent idea, but some questions:

  • how do you specify the commits to be ignored? By hash? Is the full 40-digit hash required or is 8 enough?
  • Is there a way to ignore commits by commit title, e.g., containing [docs] or some other tag?
  • The list could get large, could it be read in from another file?

Thanks @philippn : agree, this would be a nice addition you can PR this of course!

@dbwiddis: he is using the SHA-1, in lower case hexadecimal. I wouldn't use shorter ones for such use case. That's OK as-is, I wouldn't even bother supporting upper cases. I wouldn't also ignore by title because error-prone for the future, goal here being to select some old "states" to ignore. For the commit list that gets large, I would not bother too much also because if it gets large enough so that it cannot be put in a pom, then IMO, it's probably worth workaround this problem using another way, like file filtering and license sets.