-
Notifications
You must be signed in to change notification settings - Fork 69
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
Fix make copyright
#522
Fix make copyright
#522
Conversation
Deploying with Cloudflare Pages
|
4ebcaa1
to
61dc91f
Compare
Updated all Python files with the copyright notice, also updated the year since I had to touch the all anyway. Is there a reason why we have the copyright notice everywhere? It is not required, the |
.PHONY: copyright | ||
copyright: | ||
grep -EL "Copyright \(c\) 20.* Aiven" $(shell git ls-files "*.py" | grep -v __init__.py) | ||
! git grep --untracked -ELm1 'Copyright \(c\) 20[0-9]{2} Aiven' -- '*.py' ':!*__init__.py' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only code change in this patch. Notice that the --untracked
is important for the goal to make sense locally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM: git grep
finding a *.py
file (excluding __init__.py
) without the regex causes the target to fail.
The `make copyright` goal always lists all Python files that have a copyright notice, and since we have more than one file with a copyright notice it always exits with success. This does not seem right, given that there is a GHA job that is supposed to check that all files (except `__init__.py`) have a copyright notice. This changes the code used in the goal to a single git invocation that does exactly that. The `!` in front inverts the exit code. Hence, if a Python file other than `__init__.py` is found without a copyright notice it exists with a non-zero exit code and lists the paths that miss the copyright notice relative to the repository root.
61dc91f
to
0d0ede8
Compare
While no strictly needed, some best practices still recommend to add the copyright notices on the files. I guess this makes more sense in projects whose files can be easily copied over to other projects. This way its easier for the ones copying to apply the proper attribution. |
.PHONY: copyright | ||
copyright: | ||
grep -EL "Copyright \(c\) 20.* Aiven" $(shell git ls-files "*.py" | grep -v __init__.py) | ||
! git grep --untracked -ELm1 'Copyright \(c\) 20[0-9]{2} Aiven' -- '*.py' ':!*__init__.py' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM: git grep
finding a *.py
file (excluding __init__.py
) without the regex causes the target to fail.
Thanks for the contribution! |
The
make copyright
goal always lists all Python files that have a copyright notice, and since we have more than one file with a copyright notice it always exits with success. This does not seem right, given that there is a GHA job that is supposed to check that all files (except__init__.py
) have a copyright notice. This changes the code used in the goal to a single git invocation that does exactly that. The!
in front inverts the exit code. Hence, if a Python file other than__init__.py
is found without a copyright notice it exists with a non-zero exit code and lists the paths that miss the copyright notice relative to the repository root.