Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Update docs to mention pre-commit and black
NyanKiyoshi1fc05ed1c5e9
diff --git a/README.md b/README.mdindex 1fbd5afe99..8a5bb0047f 100644--- a/README.md+++ b/README.md@@ -36,8 +36,11 @@<a href="http://codecov.io/github/mirumee/saleor?branch=master"><img src="http://codecov.io/github/mirumee/saleor/coverage.svg?branch=master" alt="Codecov" /></a>- <a href='https://docs.getsaleor.com/en/latest/?badge=latest'>- <img src='https://readthedocs.org/projects/saleor/badge/?version=latest' alt='Documentation Status' />+ <a href="https://docs.getsaleor.com/en/latest/?badge=latest">+ <img src="https://readthedocs.org/projects/saleor/badge/?version=latest" alt='Documentation Status" />+ </a>+ <a href="https://github.com/python/black">+ <img src="https://img.shields.io/badge/code%20style-black-000000.svg" alt="Code style: black"></a></div>diff --git a/docs/contributing/coding-style.rst b/docs/contributing/coding-style.rstindex 66e2584cd7..f4915d2ecd 100644--- a/docs/contributing/coding-style.rst+++ b/docs/contributing/coding-style.rst@@ -1,6 +1,15 @@Coding Style============+Saleor uses the `pre-commit <https://pre-commit.com/#install>`_ tool to check and+automatically fix any formatting issue before creating a git commit.++You can easily install it after having setup saleor by running the below instruction.++.. code-block:: console++ $ pre-commit install+Python------@@ -10,34 +19,35 @@ Always follow `PEP 8 <https://www.python.org/dev/peps/pep-0008/>`_ but keep in mString Literals~~~~~~~~~~~~~~~-Prefer single quotes to double quotes unless the string itself contains single quotes that would need to be needlessly escaped.+Prefer double quotes to single quotes.Wrapping Code~~~~~~~~~~~~~-When wrapping code follow the "hanging grid" format:+When wrapping code follow the "vertical hanging indent" format:.. code-block:: pythonsome_dict = {'one': 1,'two': 2,- 'three': 3}+ 'three': 3,+ }.. code-block:: pythonsome_list = [- 'foo', 'bar', 'baz']--Python is an indent-based language and we believe that beautiful, readable code is more important than saving a single line of ``git diff``. Please avoid dangling parentheses, brackets, square brackets or hanging commas even if the Django project seems to encourage this programming style:+ 'foo',+ 'bar',+ 'baz',+ ].. code-block:: pythonthis_is_wrong = {'one': 1,'two': 2,- 'three': 3,- }+ 'three': 3}Please break multi-line code immediately after the parenthesis and avoid relying on a precise number of spaces for alignment:@@ -50,6 +60,8 @@ Please break multi-line code immediately after the parenthesis and avoid relyingLinters~~~~~~~+Use `black <https://github.com/python/black/>`_ to make sure your code is correctly formatted.+Use `isort <https://github.com/timothycrosley/isort>`_ to maintain consistent imports.Use `pylint <https://www.pylint.org/>`_ with the ``pylint-django`` plugin to catch errors in your code.