RLBotGUI
RLBotGUI copied to clipboard
Consistent python style
As mentioned in comments of #26
There are a few things that might be good to have consistent code style for. This issue is for discussing which code style we should have and how we best achieve this.
Some preferences of mine at this point in time:
- Use a linter which can automatically correct style mistakes, not just point them out
- Single quotes
- f-strings
pathlib.Pathrather than strings for describing paths.- Four space indentation.
- Discouraging
import *
One option is Black. I'm not sure how the options work, but a batch file could be created for this.
Also, doing it as a pre-commit hook or something might be useful, so we avoid situations of people accidentally not running it.
Not a pro on that, but good idea.
Are we still interested in this? I have a GitHub action config that can apply black formatting and commit/push it out after any changes land on master.
This is a commit the action pushed out: https://github.com/azeemba/RLBotGUI/commit/81632141fc0772dd41b7beec18dabedeb6a50985 Here is the configuration: action-test/.github/workflows/main.yml Here are the logs: https://github.com/azeemba/RLBotGUI/runs/828744657?check_suite_focus=true
We could expand it to also do prettier for the JS code.