Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Simplify the coding style guide

NyanKiyoshic1d952af959b
diff --git a/docs/contributing/coding-style.rst b/docs/contributing/coding-style.rst
index de58f25756..898de2a2ea 100644
--- a/docs/contributing/coding-style.rst
+++ b/docs/contributing/coding-style.rst
@@ -1,6 +1,30 @@
Coding Style
============
+Saleor uses various tools to maintain a common coding style and help with development. To install all the development tools do:
+
+.. code-block:: console
+
+ $ python -m pip install -r requirements_dev.txt``
+
+or if using ``pipenv``:
+
+.. code-block:: console
+
+ $ pipenv install --dev
+
+Saleor uses the `pre-commit <https://pre-commit.com/#install>`_ tool to check and
+automatically fix any formatting issue before creating a git commit.
+
+Run the following command to install pre-commit into your git hooks and have it run on every commit:
+
+.. code-block:: console
+
+ $ pre-commit install
+
+If you want more information on how it works, you can refer to the ``.pre-commit-config.yaml``
+configuration file.
+
Python
------
@@ -9,10 +33,13 @@ Always follow `PEP 8 <https://www.python.org/dev/peps/pep-0008/>`_ but keep in m
The only difference with ``PEP 8`` is that we use a 88 characters line limit instead of 79.
+In addition, Saleor uses the `black formatting tool <https://github.com/python/black>`_
+that comes with its own rules. A few of them are presented below.
+
String Literals
~~~~~~~~~~~~~~~
-Prefer double quotes to single quotes.
+Double quotes should be used instead of single quotes.
Wrapping Code
~~~~~~~~~~~~~
@@ -35,21 +62,6 @@ When wrapping code follow the "vertical hanging indent" format:
'baz',
]
-.. code-block:: python
-
- this_is_wrong = {
- 'one': 1,
- 'two': 2,
- 'three': 3}
-
-Please break multi-line code immediately after the parenthesis and avoid relying on a precise number of spaces for alignment:
-
-.. code-block:: python
-
- also_wrong('this is hard',
- 'to maintain',
- 'as it often needs to be realigned')
-
Linters
~~~~~~~
@@ -62,27 +74,3 @@ Use `pylint <https://www.pylint.org/>`_ with the ``pylint-django`` plugin to cat
Use `pycodestyle <http://pycodestyle.pycqa.org/en/latest/>`_ to make sure your code adheres to PEP 8.
Use `pydocstyle <http://pydocstyle.pycqa.org/en/latest/>`_ to check that your docstrings are properly formatted.
-
-Saleor uses various tools to maintain a common coding style and help with development. To install all the development tools do:
-
-.. code-block:: console
-
- $ python -m pip install -r requirements_dev.txt``
-
-or if using ``pipenv``:
-
-.. code-block:: console
-
- $ pipenv install --dev
-
-Saleor uses the `pre-commit <https://pre-commit.com/#install>`_ tool to check and
-automatically fix any formatting issue before creating a git commit.
-
-Run the following command to install pre-commit into your git hooks and have it run on every commit:
-
-.. code-block:: console
-
- $ pre-commit install
-
-If you want more information on how it works, you can refer to the ``.pre-commit-config.yaml``
-configuration file.