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

[Enhancement] Update multiple licence year ends in one run. #94

Closed
mdeweerd opened this issue Jan 8, 2024 · 4 comments
Closed

[Enhancement] Update multiple licence year ends in one run. #94

mdeweerd opened this issue Jan 8, 2024 · 4 comments

Comments

@mdeweerd
Copy link
Contributor

mdeweerd commented Jan 8, 2024

I have two lines with the licence year in my headers:

/* Copyright (c) 2012-2023 Dummy             */
/*********************************************/
/* @copyright Copyright (c) 2012-2023 Dummy  */

On the first pre-commit execution, the first line is updated.
On the second pre-commit execution, the second line is updated.
On the third run, the commit is performed.

If one of the pre-commit runs could be avoided by changing both lines in a single run that would be great.

This is my configuration:

  - repo: https://github.com/Lucas-C/pre-commit-hooks
    rev: v1.5.1
    hooks:
      - id: insert-license
        files: ^(.*\.(php))$
        args:
          - --license-filepath
          - doc/LICENSE
          - --use-current-year
          - --comment-style
          - ''
          - --no-space-in-comment-prefix
          - --fuzzy-match-extra-lines-to-check
          - '10'
          - --insert-license-after-regex
          - ^<\?php$

Note: My licence file is already updated like this:

/* Copyright (c) 2012-2024 Dummy             */
/*********************************************/
/* @copyright Copyright (c) 2012-2024 Dummy  */
@mdeweerd
Copy link
Contributor Author

Closing this as suggested in the PR - I do not have time to fix this.
I have another workaround.

@Lucas-C
Copy link
Owner

Lucas-C commented Jan 15, 2024

Sorry for not answering this earlier 😢

The issue is totally valid, thank you for reporting it @mdeweerd!
I'm going to reopen it.

Sorry if I was not clear in PR #97 about this:
I think it would be good to fix this,
I just don't know when I will personnally be able to look at it.

@Lucas-C Lucas-C reopened this Jan 15, 2024
@mdeweerd
Copy link
Contributor Author

I do not like dangling issues - nowadays bots are even closing them for us...
As you do not have the time to fix it, and me neither (because of the effort to understand the code in detail), this is one of those issues that is going to stay open forever.

The workaround is to have the same hook (and configuration) two times and use an alias for the second one.

@Lucas-C
Copy link
Owner

Lucas-C commented Jan 16, 2024

Implemented in PR #98

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

No branches or pull requests

2 participants