-
Notifications
You must be signed in to change notification settings - Fork 23
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
Feature More support for Python 3 and mixed Python 2, 2+3 and 3 #25
Feature More support for Python 3 and mixed Python 2, 2+3 and 3 #25
Conversation
I think it is relevant to also check with pylint3 while preparing and during migration from Python 2 to 2+3 or 3. pylint --py3k might also show some things to fix, so that have also been added. Option pylint_rcfile is common for all pylint* commands, just as for mypy*. Note: README.md is updated manually, since generating it using el2markdown, generates a lot of changes.
The autodect is performed via checking python version in #!/... line or a # py:<version, e.g. '2', '23', '3'> line. See README.md for details.
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 really nice, thank you! A couple of suggested changes, but overall I like the direction this is going.
@@ -535,6 +537,30 @@ def process_returncode(self, returncode): | |||
return not (returncode & 1 or returncode & 32) | |||
|
|||
|
|||
class PylintPy3kRunner(PylintRunner): | |||
"""Run pylint --py3k, producing flymake readable output. |
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.
I know it's copied from existing checkers (that I need to fix!), but can we change "flymake" to "flycheck"?
|
||
|
||
class Pylint3Runner(PylintRunner): | ||
"""Run pylint3, producing flymake readable output. |
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.
Same here, s/flymake/flycheck/
.
''' | ||
Check if first line says python/python2/python3 => Activate py2/3 checkers | ||
|
||
Can be overruled via a line: # py:<version> |
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.
Interesting! Is this a common convention, or just something you decided?
Check if first line says python/python2/python3 => Activate py2/3 checkers | ||
|
||
Can be overruled via a line: # py:<version> | ||
If <version> contains 2 -> then set py2 (1th return value) |
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.
Nit: "1st" instead of "1th".
@@ -753,11 +787,63 @@ def update_options_locally(options): | |||
return options | |||
|
|||
|
|||
def py2_py3_enable(py23_autodetect, source_file_path): | |||
# type: (str) -> bool, bool |
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 type signature looks wrong -- there are two parameters, but only one input type.
e64d6cd
to
e588b5f
Compare
##################################### Unfortunate Benny can't make the changes. It's fine with us to:
Auto-detection py:The # py: was not found elsewhere, actually we have not found any checking-help for python2-> 2+3 or 3 migration. (2to3 and futurize can modify the code but not show mistakes (well)). The background was: |
Stuff relevant primary during migration to Python 3 added
Added checkers:
** pylint-py3k (Command: pylint --py3k)
** pylint3
Autodection if a file shall be checked with a subset of the specifed checkers:
** Python 2 compatible checkers
** Python 3 compatible checkers
** Both Python 2 and 3 compatible checkers
There will never be checked with checkers not specified via arg --checkers or in CHECKERS=... in config file.
Autodection is only active if enabled via arg --py23-autodetect or PY23_AUTODETECT = 1 in config file