-
Notifications
You must be signed in to change notification settings - Fork 17
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
Fix up khan-linter to be python3-only. #42
Conversation
Now that we're on python3 everywhere, we don't need `six` anymore. Or the `vendored/py2` directory. I also changed all our shebang lines to say `python3` explicitly, rather than `python`. This isn't really needed, but some folks don't even have a /usr/bin/python on their machine, only /usr/bin/python3! And we might as well be clear. While testing this, I discovered a few lint errors that are new to new versions of python, that I cleaned up. I also discovered that the vendored pyflakes we have is too old for modern pythons, so I updated it, and also mccabe while I was at it. Issue: https://khanacademy.slack.com/archives/C02NMB1R5/p1710546934835669 Test plan: ./runlint_test.py
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.
Seems very reasonable to me. Thanks for doing this cleanup!
@@ -1,5 +1,3 @@ | |||
#!/usr/bin/env python |
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.
good catch! Presumably some refactor removed main and forgot to clean this up. Did you need to chmod? Im assuming it had the binary bit given it had a shebang.
@@ -158,7 +155,7 @@ def _extended_fnmatch_compile(pattern): | |||
|
|||
# If the code below this line has horrible syntax highlighting, check | |||
# this out: http://stackoverflow.com/questions/13210816/sublime-texts-syntax-highlighting-of-regexes-in-python-leaks-into-surrounding-c | |||
_METACHAR_RE = re.compile(r'[[*?!]') | |||
_METACHAR_RE = re.compile(r'[*?![]') |
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.
hard to tell which way is more readable.
@@ -822,7 +819,7 @@ def main(files_and_directories, | |||
except Exception: | |||
_get_logger().error(u"ERROR linting %r with %s:\n%s" % ( | |||
files, type(lint_processor), | |||
traceback.format_exc().decode('utf-8'))) | |||
traceback.format_exc())) |
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 cant keep track of what needs .decode('utf-8')
anymore. 😅
@csilvers let me know if Im blocking you from getting this one out the door :) |
Nope! I'm just using it locally for a while to make sure there are no hidden problems before I land it. |
Summary:
Now that we're on python3 everywhere, we don't need
six
anymore. Or thevendored/py2
directory.I also changed all our shebang lines to say
python3
explicitly,rather than
python
. This isn't really needed, but some folks don'teven have a /usr/bin/python on their machine, only /usr/bin/python3!
And we might as well be clear.
While testing this, I discovered a few lint errors that are new to new
versions of python, that I cleaned up. I also discovered that the
vendored pyflakes we have is too old for modern pythons, so I updated
it, and also mccabe while I was at it.
Issue: https://khanacademy.slack.com/archives/C02NMB1R5/p1710546934835669
Test plan:
./runlint_test.py