diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 295158bb..7ae92ddb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,11 +11,14 @@ * [A deliverable is to be considered “done” when](#a-deliverable-is-to-be-considered-done-when) * [Automation](#automation) * [Pre-commit hook settings](#pre-commit-hook-settings) - * [Code coverage measurement](#code-coverage-measurement) +* [Code coverage measurement](#code-coverage-measurement) +* [Linters](#linters) * [Type hints checks](#type-hints-checks) - * [Linters](#linters) + * [Ruff](#ruff) + * [Pylint](#pylint) * [Security checks](#security-checks) * [Code style](#code-style) + * [Formatting rules](#formatting-rules) * [Docstrings style](#docstrings-style) @@ -107,12 +110,19 @@ because the copied file is an executable script (so from GIT point of view it is to enable it automatically). -### Code coverage measurement +## Code coverage measurement During testing, code coverage is measured. If the coverage is below defined threshold (see `pyproject.toml` settings for actual value stored in section `[tool.coverage.report]`), tests will fail. We measured and checked code coverage in order to be able to develop software with high quality. Code coverage reports are generated in JSON and also in format compatible with [_JUnit_ test automation framework](https://junit.org/junit5/). It is also possible to start `make coverage-report` to generate code coverage reports in the form of interactive HTML pages. These pages are stored in the `htmlcov` subdirectory. Just open the index page from this subdirectory in your web browser. + + +## Linters + +_Black_, _Ruff_, Pyright, _Pylint_, __Pydocstyle__, __Mypy__, and __Bandit__ tools are used as linters. There are a bunch of linter rules enabled for this repository. All of them are specified in `pyproject.toml`, such us in sections `[tool.ruff]` and `[tool.pylint."MESSAGES CONTROL"]`. Some specific rules can be disabled using `ignore` parameter (empty now). + + ### Type hints checks It is possible to check if type hints added into the code are correct and whether assignments, function calls etc. use values of the right type. This check is invoked by following command: @@ -126,9 +136,7 @@ Subsequent runs are much faster thanks to the cache that Mypy uses. This check is part of a CI job that verifies sources. -### Linters - -_Black_, _Ruff_, Pyright, and _Pylint_ tools are used as linters. There are a bunch of linter rules enabled for this repository. All of them are specified in `pyproject.toml`, such us in sections `[tool.ruff]` and `[tool.pylint."MESSAGES CONTROL"]`. Some specific rules can be disabled using `ignore` parameter (empty now). +### Ruff List of all _Ruff_ rules recognized by Ruff can be retrieved by: @@ -145,6 +153,8 @@ Ruff rules can be disabled in source code (for given line or block) by using spe # noqa: E501 ``` +### Pylint + List of all _Pylint_ rules can be retrieved by: ``` @@ -173,6 +183,10 @@ make security-check ## Code style +### Formatting rules + +Code formatting rules are checked by __Black__. More info can be found on [https://black.readthedocs.io/en/stable/](https://black.readthedocs.io/en/stable/). + ### Docstrings style We are using [Google's docstring style](https://google.github.io/styleguide/pyguide.html). diff --git a/docs/testing.md b/docs/testing.md index 0b8e9660..1e7bc4b4 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -69,6 +69,8 @@ Currently code coverage threshold for integration tests is set to 60%. This valu As specified in Definition of Done, new changes need to be covered by tests. +[NOTE] Please do not mix pytest and unittest modules in new tests. It is preferred to use pytest in every tests, which will help the team to maintain consistency. + ### Unit tests structure