|
| 1 | +Collecting Metrics |
| 2 | +================== |
| 3 | + |
| 4 | +PTB allows you to collect various metrics on the quality of your project |
| 5 | +regarding Coverage, Security, and Static Code Analysis. |
| 6 | + |
| 7 | +For each metric there is a dedicated nox task, generating one or multiple |
| 8 | +files and based on a a selected external python tool. |
| 9 | + |
| 10 | ++-----------------------------+-----------------------------+--------------+ |
| 11 | +| Nox Task | Generated Files | Based on | |
| 12 | ++=============================+=============================+==============+ |
| 13 | +| ``lint:code`` | ``lint.txt``, ``lint.json`` | ``pylint`` | |
| 14 | ++-----------------------------+-----------------------------+--------------+ |
| 15 | +| ``lint:security`` | ``.security.json`` | ``bandit`` | |
| 16 | ++-----------------------------+-----------------------------+--------------+ |
| 17 | +| ``test:unit -- --coverage`` | ``.coverage`` | ``coverage`` | |
| 18 | ++-----------------------------+-----------------------------+--------------+ |
| 19 | + |
| 20 | +The metrics are computed for each point in your build matrix, e.g. for each |
| 21 | +Python version defined in file ``noxconfig.py``: |
| 22 | + |
| 23 | +.. code-block:: python |
| 24 | +
|
| 25 | + @dataclass(frozen=True) |
| 26 | + class Config: |
| 27 | + python_versions = ["3.9", "3.10", "3.11", "3.12", "3.13"] |
| 28 | +
|
| 29 | +The GitHub workflows of your project can |
| 30 | + |
| 31 | +* Use a build matrix, e.g. using different python versions as shown above |
| 32 | +* Define multiple test sessions, e.g. for distinguishing fast vs. slow or expensive tests. |
| 33 | + |
| 34 | +PTB combines the coverage data of all test sessions but using only the python |
| 35 | +version named first in attribute ``python_versions`` of class ``Config``. |
0 commit comments