Repository navigation
Restore copyright check - #975
Conversation
| @@ -0,0 +1,19 @@ | |||
| .clang-format | |||
| .diff | |||
| .md | |||
There was a problem hiding this comment.
Should we use gitignore format? There is a parser for it https://pypi.org/project/gitignore-parser/
There was a problem hiding this comment.
We can consider it as an enhancement, either by switching to other tools to retrieve the list of files (git ls-files exlcude options only work with "ignored" or "other" files) or doing that ourselves. But I think it is out of scope for this PR.
Note that this is just a file for the (extended) patterns we had in our workflow: https://github.com/model-checking/kani/blob/main/.github/workflows/format-check.yml#L16
celinval
left a comment
There was a problem hiding this comment.
It looks good to me. Thanks for jumping on this one.
One improvement we should do later is to detect if the file has a previous copyright statement. I think this would fail today, but it should be OK to have an original copyright statement followed by our modified copyright statement.
| print('FAIL') | ||
|
|
||
| # Convert checks into boolean values to determine the exit code | ||
| bool_checks = map(result_into_bool, checks) |
There was a problem hiding this comment.
nit: Can you just add a variable to the for loop that gets assigned to false if we ever hit the FAIL branch?
Yes, because it expects the headers to be in an (almost) fixed set of lines in the file. But I agree, there are lots of room for improvement here (e.g., using a sliding window to detect headers instead). |
* Add script for copyright check and extend for modified headers * Simplify copyright step in workflow * Add copyright header to files that were missing it * Use variable to determine exit code
* Add script for copyright check and extend for modified headers * Simplify copyright step in workflow * Add copyright header to files that were missing it * Use variable to determine exit code
Description of changes:
The copyright check has been broken for some time. This PR restores the check by making it work with shallow clones (the reason it broke) and extends the check itself to detect "modified" copyright headers.
Resolved issues:
Resolves #961
Call-outs:
Testing:
How is this change tested? Running in CI.
Is this a refactor change? No.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.