Lucas-C / pre-commit-hooks

git pre-commit hooks

Home Page:http://pre-commit.com/hooks.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

insert_license - Inserting new license with --use-current-year replaces start years in ranges

pezcode opened this issue · comments

When a file has no license and one gets inserted with --use-current-year enabled, all years are replaced with the current year. This destroys year ranges.

Input LICENSE.txt:

 Copyright © 2020-2022 Steve Luamo <steve@luamo.com>
 Copyright © 2015-2022 Leve Stuamo <leve@stuamo.com>

Inserted license comment, if none exists:

 /*
  * Copyright © 2023-2023 Steve Luamo <steve@luamo.com>
  * Copyright © 2023-2023 Leve Stuamo <leve@stuamo.com>
  */

Indeeed, I see the problem.
--use-current-year is probably not adapted to those kind of license headers 😊

Do you see any potential workaround or have any suggestion regarding this @pezcode?

@pezcode: could you please try the latest version of this hook on the master branch?

- repo: https://github.com/Lucas-C/pre-commit-hooks
  rev: master
  hooks:
    - id: insert-license

@aostrowski made some changes in #66 that should fix this

#66 fixed the issue, thank you so much @aostrowski 🙏