-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
Run Python flake8 tests on several Nodejs repos #21942
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__DO NOT MERGE__: This will run the [flake8](http://flake8.pycqa.org) linter on several Nodejs repos that contain Python code to detect syntax errors and undefined names which can raise NameError at runtime. There is a discussion in nodejs/node-gyp#1336 about the importance of using tools like Travis CI to automate the discovery of code quality issues. __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. This PR therefore demonstrates such a flake8 run these Nodejs codebases. * F821: undefined name `name` * F822: undefined name `name` in `__all__` * F823: local variable `name` referenced before assignment * E901: SyntaxError or IndentationError * E999: SyntaxError -- failed to compile a file into an Abstract Syntax Tree
This was referenced Jul 23, 2018
Closing with output at https://travis-ci.com/nodejs/node/builds/79706150 |
cclauss
changed the title
WIP: DO NOT MERGE: Flake8 tests on Nodejs repos
Run Python flake8 tests on several Nodejs repos
Jul 23, 2018
cclauss
pushed a commit
to cclauss/node-chakracore
that referenced
this pull request
Jul 23, 2018
__xrange()__ was removed in Python 3 in favor of __range()__. This PR ensures similar functionality on both Python 2 and Python 3. Similar to nodejs/nan#797 Discovered via https://travis-ci.com/nodejs/node/builds/79706150 (nodejs/node#21942) flake8 testing of https://github.com/nodejs/node-chakracore on Python 3.7.0 $ __flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics__ ``` ./tools/cpplint.py:1471:12: F821 undefined name 'xrange' for i in xrange(startpos, len(line)): ^ ./tools/cpplint.py:1700:15: F821 undefined name 'xrange' for line in xrange(1, min(len(lines), 11)): ^ ./tools/cpplint.py:1828:12: F821 undefined name 'xrange' for i in xrange(1, len(raw_lines) - 1): ^ ./tools/cpplint.py:2169:14: F821 undefined name 'xrange' for i in xrange(linenum - 1, self.starting_linenum, -1): ^ ./tools/cpplint.py:2950:26: F821 undefined name 'xrange' for start_linenum in xrange(linenum, clean_lines.NumLines()): ^ ./tools/cpplint.py:3437:14: F821 undefined name 'xrange' for i in xrange(first_line, last_line + 1, 1): ^ ./tools/cpplint.py:3501:19: F821 undefined name 'xrange' for offset in xrange(endlinenum + 1, ^ ./tools/cpplint.py:4047:14: F821 undefined name 'xrange' for i in xrange(linenum + 1, end_line): ^ ./tools/cpplint.py:4218:23: F821 undefined name 'unicode' if isinstance(line, unicode): ^ ./tools/cpplint.py:4870:12: F821 undefined name 'xrange' for i in xrange(linenum, max(-1, linenum - 10), -1): ^ ./tools/cpplint.py:4891:12: F821 undefined name 'xrange' for i in xrange(linenum, max(-1, linenum - 10), -1): ^ ./tools/cpplint.py:4907:12: F821 undefined name 'xrange' for i in xrange(linenum, 1, -1): ^ ./tools/cpplint.py:5008:20: F821 undefined name 'xrange' for i in xrange(startline, linenum + 1): ^ ./tools/cpplint.py:5032:14: F821 undefined name 'xrange' for i in xrange(linenum - 1, max(0, linenum - 10), -1): ^ ./tools/cpplint.py:5063:14: F821 undefined name 'xrange' for i in xrange(2): ^ ./tools/cpplint.py:5226:14: F821 undefined name 'xrange' for i in xrange(linenum - 1, max(0, linenum - 5), -1): ^ ./tools/cpplint.py:5442:18: F821 undefined name 'xrange' for linenum in xrange(clean_lines.NumLines()): ^ ./tools/cpplint.py:5573:21: F821 undefined name 'xrange' for start_line in xrange(linenum, min(linenum + 3, clean_lines.NumLines())): ^ ./tools/cpplint.py:5588:12: F821 undefined name 'xrange' for i in xrange(end_line, min(end_line + 3, clean_lines.NumLines())): ^ ./tools/cpplint.py:5845:15: F821 undefined name 'xrange' for line in xrange(clean_lines.NumLines()): ^ ```
4 tasks
cclauss
pushed a commit
to cclauss/node
that referenced
this pull request
Jul 23, 2018
__xrange()__ was removed in Python 3 in favor of __range()__. This PR ensures similar functionality on both Python 2 and Python 3. Discovered via https://travis-ci.com/nodejs/node/builds/79706150 (nodejs#21942)
This was referenced Jul 23, 2018
addaleax
pushed a commit
that referenced
this pull request
Jul 27, 2018
__xrange()__ was removed in Python 3 in favor of __range()__. This PR ensures similar functionality on both Python 2 and Python 3. Discovered via https://travis-ci.com/nodejs/node/builds/79706150 (#21942). PR-URL: #21945 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: James M Snell <[email protected]>
targos
pushed a commit
that referenced
this pull request
Jul 31, 2018
__xrange()__ was removed in Python 3 in favor of __range()__. This PR ensures similar functionality on both Python 2 and Python 3. Discovered via https://travis-ci.com/nodejs/node/builds/79706150 (#21942). PR-URL: #21945 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: James M Snell <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
DO NOT MERGE: This PR uses Travis CI to run the flake8 linter on several Nodejs repos that contain Python code to detect syntax errors and undefined names which can raise NameError at runtime. There is a discussion in nodejs/node-gyp#1336 about the importance of using tools like Travis CI to automate the discovery of code quality issues.
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. This PR therefore demonstrates such a flake8 run these Nodejs codebases.
name
name
in__all__
name
referenced before assignmentChecklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes