This repository was archived by the owner on Jan 3, 2026. It is now read-only.
Travis CI: flake8 tests to find Python syntax errors & undefined names - #22
Merged
Conversation
…d names Add [flake8](http://flake8.pycqa.org) tests to find Python syntax errors and undefined names. __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. * 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
exception (lowercase 'e') is an undefined name in this context while Exception (uppercase 'e') is the superclass. flake8 testing of https://github.com/cclauss/pythonparser on Python 2.7.14 $ flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics ./pythonparser/source.py:259:9: F821 undefined name 'exception' exception.__init__(self, "Ranges %s and %s overlap" % (repr(first), repr(second))) ^ 1 F821 undefined name 'exception' 1
Also follow Python porting best practice [__use feature detection instead of version detection__](https://docs.python.org/3/howto/pyporting.html#use-feature-detection-instead-of-version-detection).
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Add flake8 tests to find Python syntax errors and undefined names.
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__Undefined name: exception --> Exception
exception (lowercase 'e') is an undefined name in this context while Exception (uppercase 'e') is the superclass.
flake8 testing of https://github.com/m-labs/pythonparser on Python 2.7.14
$ flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
Fix indentation error in
LongOnly.__ne__()