lluissm / license-header-checker

Command line utility to check whether the license headers are included in the source code files of a project. It can also insert/replace.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Copyright year

huntantr opened this issue · comments

When using this tool to check for a copyright, is there anyway to make the year be less specific. We have source code that hasn't changed in years, so it won't have a 2022 year in it, but a 2020.

Thanks.

Hello @huntantr,

Can you please describe the concrete use case you want to achieve so I can better help you?

I assume he wants unchanged files to retain the original copyright year.

example.h with copyright 2020, should remain 2020 until example.h is changed.

If example.h is changed in 2022, then it should change to copyright 2020, 2022

If the -r flag is not supplied, the tool will not replace the copyright header if there is already one. You could just use -a to only add to the ones that do not have any.

But then, if you need to update the year in the copyright header after modifying the file, you should do it manually when you update the file as the tool does not really know when you modified the file.