Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
style guide documentation updates
  • Loading branch information
StoicLoofah committed Jan 31, 2022
commit a5d2e3cd98aadfc913845f7b70a907fe21beb6f5
15 changes: 8 additions & 7 deletions STYLE_GUIDE.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
STYLE GUIDE
==============

As a rough style guide, please lint your code with pep8::
As a rough style guide, please lint your code with black, codespell, and flake8::

pip install pep8
pep8 --ignore E501,E226,E241 sc2reader
pip install black codespell flake8
codespell -L queenland,uint
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
black . --check

More up-to-date checks may be detailed in `.circleci/config.yml`.

All files should start with the following::

Expand All @@ -18,10 +22,7 @@ All files should start with the following::
All imports should be absolute.


All string formatting sound be done in the following style::
All string formatting should be done in the following style::
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually wasn't sure if we should insist on .format or if we should support f-strings

Copy link
Collaborator

@cclauss cclauss Jan 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pyupgrade will autoconvert to f-strings which are faster and easier to read.
https://www.scivision.dev/python-f-string-speed/


"my {0} formatted {1} string {2}".format("super", "python", "example")
"the {x} style of {y} is also {z}".format(x="dict", y="arguments", z="acceptable")

The format argument index numbers are important for 2.6 support. ``%`` formatting is not allowed for 3.x support