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
[Enhancement] - Progressively change the code to be PEP8 and Flake8 compliant #476
Comments
I just had a go with the pep8ify tool (http://pep8ify.com/) and applied on the oppia/gamification directory in the pep8ify branch (https://github.com/DigitalCampus/django-oppia/tree/pep8ify) Seems that tool would make it quite easy to update all the code... |
TBH most of the rules are easily mechanizable: one blank line between functions, spaces instead of tabs and so on... so I believe that these can be automatically changed. If we had a good test bench, we could be doing a whole project pep8ify and check automatically if something got broken. |
Can also use pycodestyle (http://pycodestyle.pycqa.org/en/latest/index.html) to help with this |
Remaining issues for this (with the exception of long line issues) are:
|
The bare except can be changed to a "except Exception" I believe that catches all the exceptions unless you want to catch other types of system-exiting exceptions (like KeyboardInterrupt). |
Thanks! I found a lot of these 'bare' excepts were around JSON parsing, so I was able to put in specific json encoding exceptions |
Getting rid of pokemon exceptions is always good 💃 |
I updated this to include Flake8 too - from running this it picks up a lot of additional issues than pycodestyle does on it's own, eg. unused imports etc - see this file for the current list of Flake8 lint warnings |
transferred to OPPIA-48 |
I think it would be great if the code would be PEP8 compliant.
In case that you don't know, the PEP8 is an official "style guide" from the Python team for Python code. PyCharm helps a lot with this, but I know it is a pain to go through all the files in the project doing small changes here and there. I just leave this idea for the future, especially if there is going to be a project-wide refactor. What do you think?
The text was updated successfully, but these errors were encountered: