-
-
Notifications
You must be signed in to change notification settings - Fork 758
Add flake8 checks for license and copyright headers #4657
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
Conversation
@Kami @bigmstone I'm going to fix this first and then add an extension to check copyright header. |
6d48729
to
57cefab
Compare
ba8f033
to
18c73ad
Compare
Add the current license header to files that do not have the header. Fix the license header in files if the text does not match.
Update the test_content_version submodule to pull the latest commit with the Apache 2.0 license header added to files.
Replace the custom Apache 2.0 license header to the standard Apache 2.0 license header in code files.
Add the hacking module to check code files for the standard Apache 2.0 license header. Update the flake8 config file and disable all other hacking checks.
Add copyright header above license header on all code files.
Add flake8-copyright to test requirements and configure the copyright check in the flake8 configuration file.
18c73ad
to
9b8d918
Compare
@@ -436,7 +436,7 @@ requirements: virtualenv .sdist-requirements install-runners | |||
(cd ${ROOT_DIR}/st2common; ${ROOT_DIR}/$(VIRTUALENV_DIR)/bin/python setup.py develop --no-deps) | |||
|
|||
# Some of the tests rely on submodule so we need to make sure submodules are check out | |||
git submodule update --init --recursive | |||
git submodule update --recursive --remote |
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.
Just curious why this change is needed.
test-requirements.txt
Outdated
@@ -2,6 +2,7 @@ | |||
coverage==4.5.2 | |||
pep8==1.7.1 | |||
flake8==3.7.7 | |||
hacking |
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.
Probably not a bad idea to pin it to a specific version to avoid surprises when a new version if published / similar. This has bitten us many times already in the past, same for flake8-copyright
.
Although checking hacking
docs (https://pypi.org/project/hacking/) it looks like hacking
itself installs specific versions of pep8
, etc. so there could be potential conflicts down the road.
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.
@Kami Pinned both flake8-copyright and hacking in test-requirements.txt. Why did we pin a specific version of pep8 (pep8==1.7.1)?
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.
New versions (> 2.0.0, IIRC), only work with Python 3.
EDIT: Nvm, that's pylint and not pep8.
Pin version for flake8-copyright and hacking to avoid unexpected conflict due to version changes.
73fe88f Fix merge conflict. 72d3b7c Merge pull request #1 from StackStorm/update_lint_configs 2709c47 Update lint config with changes from StackStorm/st2#4657. git-subtree-dir: lint-configs git-subtree-split: 73fe88f2da7403d69bc5ebd7c6d22d12860c3744
73fe88f Fix merge conflict. 72d3b7c Merge pull request #1 from StackStorm/update_lint_configs 2709c47 Update lint config with changes from StackStorm/st2#4657. 418d2eb Sync flake8 config with StackStorm/st2 master. 9b6b10b Update flake8 config so we ignore build/ and dist/ directories. e43b03a Update pylint config. git-subtree-dir: lint-configs git-subtree-split: 73fe88f2da7403d69bc5ebd7c6d22d12860c3744
f0fd0b6 Merge pull request #2 from StackStorm/python-license-check 63e6d42 Add new .flake-proprietary config file which is to be used with proprietary repos. 67d2846 Update flake8 config to enable extensions a164dc1 Add .gitignore to project 13e0509 Add flake8 plugin to check license header 302b88c Also ignore H210 errors. ffbe682 Enable H checks to missing license errors are reported. 3be3554 Merge branch 'update_lint_configs' 9a5b6db Add a docstring. 73fe88f Fix merge conflict. 72d3b7c Merge pull request #1 from StackStorm/update_lint_configs 2709c47 Update lint config with changes from #4657. git-subtree-dir: lint-configs git-subtree-split: f0fd0b61e29a9623eeb87aaf82c3a98aab9271ff
Add custom flake8 extension to check that the Apache 2.0 license is included in code files.
Add Apache 2.0 license header to files that does not have it. Fix Apache 2.0 license header if it
doesn't match the header that is expected.