nmccrea / sobot-rimulator

Autonomous mobile robot simulator.
GNU General Public License v3.0
267 stars 146 forks source link

Lint Python code for syntax errors #4

Closed cclauss closed 4 years ago

cclauss commented 4 years ago

Demonstrating why we need #3 or similar. Five files with Python syntax errors.

Output: https://github.com/cclauss/sobot-rimulator/actions

flake8 testing of https://github.com/nmccrea/sobot-rimulator on Python 3.8.3

$ flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics

./models/supervisor_state_machine.py:180:11: E999 SyntaxError: invalid syntax
    print "\n ======== \n"
          ^
./models/controllers/gtg_and_ao_controller.py:106:11: E999 SyntaxError: invalid syntax
    print "\n\n"
          ^
./models/controllers/go_to_goal_controller.py:92:11: E999 SyntaxError: invalid syntax
    print "\n\n"
          ^
./models/controllers/follow_wall_controller.py:182:11: E999 SyntaxError: invalid syntax
    print "\n\n"
          ^
./models/controllers/avoid_obstacles_controller.py:114:11: E999 SyntaxError: invalid syntax
    print "\n\n"
          ^
5     E999 SyntaxError: invalid syntax
5

https://flake8.pycqa.org/en/latest/user/error-codes.html

On the flake8 test selection, this PR does not focus on "style violations" (the majority of flake8 error codes that psf/black can autocorrect). Instead these tests are focus on runtime safety and correctness:

nmccrea commented 4 years ago

@cclauss thanks so much for this. This project has been in suspended animation for some time but I will be getting things moving again in short order.

nmccrea commented 4 years ago

@cclauss Thank you very much for this. I have now linted this entire project with black, codespell, and flake8. I made some modifications to the Github action you created here but the spirit remains the same.

Among other things I have made the action fail if any of these three tools find problems. At the moment, these checks still do not pass. This is because there are a handful of remaining problems found by black and flake8. They fall into two categories:

My hope is that we can get these remaining problems cleaned up before long and then begin enforcing this action for all PRs.