Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upMakefile: Add lint-python which uses flake8 #21952
Conversation
nodejs-github-bot
added
the
build
label
Jul 24, 2018
This comment has been minimized.
This comment has been minimized.
|
Is it not possible to bundle the linting library instead, like we do for eslint? That way we don't need to make system-wide changes (e.g. implicitly upgrading pip)? |
This comment has been minimized.
This comment has been minimized.
|
We could remove pip install —upgrade pip. |
This comment has been minimized.
This comment has been minimized.
|
@mscdex Does that last commit cover what you wanted or did I misunderstand your request? Is the automated testing actually doing a "make lint"? If so, how do I view the output? https://github.com/nodejs/node/runs/8932739 does not seem to contain the words "lint-python" or "flake8". |
cclauss
referenced this pull request
Jul 24, 2018
Closed
Travis CI: Add flake8 jobs for Python 2.7 and Python 3.7 #21953
targos
reviewed
Jul 24, 2018
| # Flag the build if there are Python syntax errors or undefined names | ||
| lint-python: lint-python | ||
| @echo "Running Python linter on $(shell $(PYTHON) --version)..." | ||
| @$(PYTHON) -m pip install --upgrade flake8 |
This comment has been minimized.
This comment has been minimized.
targos
Jul 24, 2018
Member
This doesn't work on my system when not run as root:
OSError: [Errno 13] Permission denied: '/usr/lib/python2.7/site-packages/enum34-1.1.6.dist-info'
make[1]: *** [Makefile:1212: lint-python] Error 2
This comment has been minimized.
This comment has been minimized.
cclauss
Jul 24, 2018
Author
Contributor
Can you please try to add --user to the command and let me know if that works?
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Exclusions don't seem to work. I see many errors coming from |
This comment has been minimized.
This comment has been minimized.
|
You see these errors where? Locally or in server-based build log? |
This comment has been minimized.
This comment has been minimized.
|
Locally, with |
This comment has been minimized.
This comment has been minimized.
refack
approved these changes
Jul 24, 2018
|
This comment has been minimized.
This comment has been minimized.
|
Hello @cclauss and thank you for the contribution |
refack
added
tools
python
labels
Jul 24, 2018
refack
self-assigned this
Jul 24, 2018
This comment has been minimized.
This comment has been minimized.
|
I implemented all suggestions except:
|
richardlau
reviewed
Jul 24, 2018
| .PHONY: lint-python | ||
| # Lints the Python code with flake8. | ||
| # Flag the build if there are Python syntax errors or undefined names | ||
| lint-python: lint-python |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
What I meant was include the 'flake8' module in the repo, like we do with eslint for js files, to avoid having to install it system/user-wide (which I would find to be unexpected behavior). |
This comment has been minimized.
This comment has been minimized.
|
What's the status on this one? |
jasnell
added
the
stalled
label
Sep 10, 2018
This comment has been minimized.
This comment has been minimized.
refack
force-pushed the
cclauss:add-flake8-to-testing
branch
from
a4f0ae4
to
4458162
Oct 21, 2018
refack
approved these changes
Oct 21, 2018
refack
approved these changes
Oct 21, 2018
refack
approved these changes
Oct 21, 2018
refack
approved these changes
Oct 22, 2018
refack
approved these changes
Oct 22, 2018
refack
approved these changes
Oct 22, 2018
refack
approved these changes
Oct 22, 2018
refack
approved these changes
Oct 22, 2018
This comment has been minimized.
This comment has been minimized.
|
That is lots of approval... https://blog.github.com/2018-10-21-october21-incident-report |
cclauss commentedJul 24, 2018
•
edited
Add a lint-python section to Makefile which pip installs flake8 and then executes:
Based on the experimentation done at https://travis-ci.com/nodejs/node/builds/79706150 - #21942
These tests currently exclude several directories and files:
Hopefully this list can be reduced in future PRs with code modifications or the use of # noqa
E901,E999,F821,F822,F823 are the "showstopper" flake8 issues that can halt the runtime with a SyntaxError, NameError, etc. Most other flake8 issues are merely "style violations" -- useful for readability but they do not effect runtime safety.
namenamein__all__namereferenced before assignmentChecklist
make -j4 test(UNIX), orvcbuild test(Windows) passes