RLBotGUI icon indicating copy to clipboard operation
RLBotGUI copied to clipboard

Consistent python style

Open DomNomNom opened this issue 6 years ago • 5 comments

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.

DomNomNom avatar Mar 24 '19 04:03 DomNomNom

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.Path rather than strings for describing paths.
  • Four space indentation.
  • Discouraging import *

DomNomNom avatar Mar 24 '19 04:03 DomNomNom

One option is Black. I'm not sure how the options work, but a batch file could be created for this.

amsam0 avatar Jun 16 '19 02:06 amsam0

Also, doing it as a pre-commit hook or something might be useful, so we avoid situations of people accidentally not running it.

DomNomNom avatar Jun 16 '19 02:06 DomNomNom

Not a pro on that, but good idea.

amsam0 avatar Jun 16 '19 02:06 amsam0

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.

azeemba avatar Jul 02 '20 00:07 azeemba