From 547bf0988ef81edb25fd0783b8d635108f614626 Mon Sep 17 00:00:00 2001 From: anoadragon453 Date: Tue, 3 May 2022 10:52:17 +0000 Subject: deploy: 7e6598bcf6cf63b4d04c27b9696ed8429b6ddff6 --- latest/code_style.html | 49 +++++++++++++++---------------------------------- 1 file changed, 15 insertions(+), 34 deletions(-) (limited to 'latest/code_style.html') diff --git a/latest/code_style.html b/latest/code_style.html index 0620f138e3..9f965d2dc1 100644 --- a/latest/code_style.html +++ b/latest/code_style.html @@ -76,7 +76,7 @@ @@ -151,49 +151,30 @@

The Synapse codebase uses a number of code formatting tools in order to quickly and automatically check for formatting (and sometimes logical) errors in code.

-

The necessary tools are detailed below.

-

First install them with:

-
pip install -e ".[lint,mypy]"
-
+

The necessary tools are:

+

Install them with:

+
pip install -e ".[lint,mypy]"
 
- -
  • -

    isort

    -

    isort ensures imports are nicely formatted, and can suggest and -auto-fix issues such as double-importing.

    -

    Auto-fix imports with:

    -
    isort .
    +

    The easiest way to run the lints is to invoke the linter script as follows.

    +
    scripts-dev/lint.sh
     
    -
  • -

    It's worth noting that modern IDEs and text editors can run these tools automatically on save. It may be worth looking into whether this functionality is supported in your editor for a more convenient -development workflow. It is not, however, recommended to run flake8 on -save as it takes a while and is very resource intensive.

    +development workflow. It is not, however, recommended to run flake8 or mypy +on save as they take a while and can be very resource intensive.

    General rules

    • Naming:
        -
      • Use camel case for class and type names
      • -
      • Use underscores for functions and variables.
      • +
      • Use CamelCase for class and type names
      • +
      • Use underscores for function_names and variable_names.
    • Docstrings: should follow the google code -- cgit 1.5.1