Change: limit copyright year check to fileheader and copyright tag #743
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
Rework check_copyright_year to only check lines in the NASL fileheader and the script_copyright tag.
The NASL header starts at the beginning of the file. Each line of it must start with a '#'. The first line that does not contain a '#' is no longer part of the header. Only a single continuous header is tested.
script_copyright tag value is retrieved directly with helper pattern.
Changed regex for identifying copyright and its year.
Special cases where an additional copyright that does not cover since creation, but starts later, does not need to be added to the ignore list, as long as it follows the same format as the one in gather-package-list.nasl. Then it will not pass the regex and will not throw a lintererror if there is a newer year. But you have to check manually if these are correct.
Ignore-list is reset.
https://github.com/greenbone/vulnerability-tests/pull/12683 fixes the necessary files that would now trigger a error.
With this PR, this check now finds 0 errors in the VT repo.
Why
It would erroneously identify copyrights in files that were not actually copyrights of that file but just part of comments.
References
VTOPS-230
Checklist