Skip to content

Coding Standard

Nils Schmitt edited this page May 26, 2024 · 14 revisions

In this repository we enforce the following coding standards.

Tools

Pylint

In this project we use Pylint as Linter with the following configuration:

[MESSAGES CONTROL]
disable=
  too-many-arguments,
  too-many-locals,
  too-many-return-statements,
  too-many-branches,
  too-many-instance-attributes,
  too-many-statements,
  duplicate-code,
  logging-not-lazy,
  consider-using-f-string,
  fixme,
  import-error,
  unspecified-encoding,
  too-few-public-methods,
  import-outside-toplevel,
  no-name-in-module,
  unexpected-keyword-arg,

[FORMAT]
max-line-length=120
indent-string='    '
init-import=yes

[REFACTORING]
max-nested-blocks=6

[MASTER]
ignore=setup.py
ignore-paths=^tracex_project/extraction/migrations/.*$,
ignore-patterns=__init__.py

[DESIGN]
max-parents=10

This ensures the PEP 8 coding standard for python. We have made minimal modifications for our project for improved readability and ease of use. The modifications are the extension of line length to 120 characters and the preffered use of tabs over spaces.

Pre-Commit

Another code formatting tool in use is Pre-Commit. This prevents commits of code with formatting issues. We use it with the following configuration:

repos:
-   repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.5.0
    hooks:
    -   id: end-of-file-fixer
    -   id: trailing-whitespace
-   repo: https://github.com/psf/black
    rev: 23.11.0
    hooks:
    -   id: black
Clone this wiki locally