GrandOrgue / grandorgue

GrandOrgue software
Other
166 stars 40 forks source link

Added using a pre-commit hook to automatically update the years in copyright headers of the source files #1839

Closed nanoufo closed 6 months ago

nanoufo commented 6 months ago

I have developed a tool for updating copyright headers.

It is a unique tool that:

  1. is written in Python, so it does not require the installation of any additional dependencies as pre-commit is also written in Python.
  2. capable of examining the old git history to detect files where the copyright years remain outdated.
  3. is fast. My tool does not launch a separate git subprocess for each file. On my computer, it analyzes the entire GO git history in just 2 seconds, with only 0.3 seconds needed to analyze the history for the year 2024.
  4. does not categorize file movements as modifications.
  5. enables users to 'forget' about incorrect years in copyright headers for files last modified before a specified date.

My previous pull request, #1834, was generated using this tool. This pull request adds the execution of this tool to pre-commit hooks.

rousseldenis commented 6 months ago

@nanoufo thanks for this! Seems great. Can't you use tags on your repo to identify more easily your tool version (and changes) instead of commit sha?

larspalo commented 6 months ago

I just noted that in the info at https://github.com/nanoufo/copyright-hook the GitHub actions code is

- uses: actions/checkout@v4
  with:
    fetch-depth: 0 # Important!
- uses: actions/setup-python@v5
- uses: pre-commit/action@v3.0.1

whereas the versions here are

      - uses: actions/setup-python@v2
      - uses: pre-commit/action@v2.0.0

Any specific reason, or is this not important?

nanoufo commented 6 months ago

I just noted that in the info at https://github.com/nanoufo/copyright-hook the GitHub actions code is Any specific reason, or is this not important?

Not important. I used the latest version in the example.