kt3k / license-checker

:page_facing_up: CLI tool for checking license headers in files
https://jsr.io/@kt3k/license-checker
MIT License
29 stars 7 forks source link

Check copyright year #12

Open bmarwell opened 3 years ago

bmarwell commented 3 years ago

Hi,

is there support for copyright year check? Some projects use start,lastmod. E.g. Copyright 2011,2021 …

Others modify the date only on updating the file, so some files might have Copyright 2021 … while others have older years.

And a mix of both, obviously.

kt3k commented 3 years ago

Currently there is no support of mixed years in copyright headers.

Is mixing years in copyright header common or good thing? Personally I often see people updating all years in headers around the new years day.

bmarwell commented 3 years ago

Personally I often see people updating all years in headers around the new years day.

Yikes. I am a java developer and contribute to apache projects. As far as I can tell, there is usually one year only, which is updated when the file is being modified. I do not think updating projects at new year is a good thing. It is not a functional change, and if forgotten will fail PRs and future builds.

bmarwell commented 3 years ago

Also mentioned in the GPL FAQ: https://www.gnu.org/licenses/gpl-howto.html

kt3k commented 3 years ago

If mixture of different years is allowed, do you have any idea of the design of the config file?

bmarwell commented 3 years ago

I basically would allow regex to be included. Sadly this would not be downwards compatible.

ni4 commented 3 years ago

Got to this repository via search, to automate latest year inclusion. I.e. just to check whether pushed files contains current year in copyright string. It could be done as dealing with copyright as regexp, adding some placeholders like ${YEAR}, ${FILENAME}, maybe something else could be useful as well.

mars-risc0 commented 1 year ago

Is mixing years in copyright header common or good thing?

I don't think I have ever seen a codebase older than one year which did not include mixed years in copyright headers. It is common to see a range, for example "Copyright (c) 2003-2009 Foo, Inc.".

Personally I often see people updating all years in headers around the new years day.

Several of the places I have worked would have absolutely forbidden such a large, non-functional change across the entire codebase.

kt3k commented 1 year ago

I'm now thinking about the config structure like the below for allowing multiple year patterns.

{
  "**/*.js": "// Copyright {YEAR} My Name. All rights reserved. MIT license.",
  "params": {
    "YEAR": "some regexp?"
  }
}
ladislas commented 1 year ago

@kt3k this would be amazing!