From 5b10db95072f21b832ae587306483c11228d957e Mon Sep 17 00:00:00 2001 From: Dominik George <dominik.george@teckids.org> Date: Fri, 13 Dec 2019 14:14:02 +0100 Subject: [PATCH] Update coding style guidelines Closes #117. --- CONTRIBUTING.rst | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 6d394aa73..b68607dc4 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -12,22 +12,30 @@ Coding layout and style The coding style is defined in `PEP 8`_, with the following differences and decisions: +- The defaults of the `black`_ code formatter are used + - This implies all string literals usin double-quotes, if it does not lead + to more escaping. As proposed by `black`: "My recommendation here is to + keep using whatever is faster to type and let Black handle the transformation." - The maximum line length is 100 characters - Imports are structured in five blocks, each of them sorted as defined in - PEP 8: + PEP 8 and the Django style guide: 1. Standard library imports 2. Django imports 3. Third-party imports - 4. Imports from other BiscuIT apps (absolute imports) + 4. Imports from BiscuIT core and other apps (absolute imports) 5. Imports from the same BiscuIT app (realtive imports) -- All string literals use single quotes + Use `isort` to take care of this For the layout of source trees and style recommendations specific to Django, the `Django coding style`_ is a good source of information, together with the `Django Best Practices`_ collection. +To ensure code is styled correctly, before commiting, run:: + + tox -e reformat + Working with the Git repository ------------------------------- -- GitLab