You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+50-41Lines changed: 50 additions & 41 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,58 +3,67 @@
3
3
4
4
# MFD Code Quality
5
5
6
-
## Usage
7
-
8
-
This module provides set of code quality related methods with corresponding command line commands.
9
-
10
-
### Available commands
11
-
12
-
When installing `mfd-code-quality` package all these commands will become available from command line - in the same way as `pip` for example.\
13
-
So you can just type `mfd-help` in your terminal without a need to call it from Python.
14
-
15
-
16
-
> `mfd-configure-code-standard`\
17
-
> Prepare code standard configuration files into repository and setup pre commit.
6
+
This module provides a set of code quality methods.\
7
+
Installing this package will also **add the corresponding executable files to your environment**, allowing you to run each code quality check with a simple command-line call.
18
8
19
-
> `mfd-create-config-files`\
20
-
> Prepare code standard configuration files into repository without setup of pre commit.\
21
-
> Mechanism of creating configs is the same as in 'mfd-configure-code-standard'.
22
-
23
-
> `mfd-code-standard`\
24
-
Run code standard test using ruff (format, check) or flake8. Depending on what is available. It copies configuration files before code standard check and remove their after check.
25
-
> It's not required to call `mfd-configure-code-standard` or `mfd-create-config-files` before running this command.
26
-
27
-
> `mfd-import-testing`\
28
-
Run import testing of each Python file to check import problems.
9
+
## Usage
29
10
30
-
> `mfd-system-tests`\
31
-
Run system tests.
11
+

32
12
33
-
> `mfd-unit-tests`\
34
-
Run unittests, print actual coverage, but don't check its value.
13
+
When installing `mfd-code-quality` package all these commands will become available from command-line - in the same way as `pip` for example.\
14
+
So you can just type i.e. `mfd-help` in your terminal without a need to call it from Python.\
15
+
If command requires configuration, such config will be automatically created and removed after.
35
16
36
-
> `mfd-unit-tests-with-coverage`\
37
-
Run unittests and check if diff coverage (new code coverage) is reaching the threshold.
|`mfd-code-standard`| Check code standard using Ruff (`format`, `check`) or flake8. Depending on what is available. |
23
+
|`mfd-code-format`| Format code using `ruff check --fix` and `ruff format`. |
24
+
|`mfd-import-tests`| Try to import each Python file to check import problems. |
25
+
|`mfd-system-tests`| Run system tests. |
26
+
|`mfd-unit-tests`| Run unit tests. |
27
+
|`mfd-unit-tests-with-coverage`| Run unittests and check if diff coverage (new code coverage) is reaching the threshold (**80%**). |
28
+
|`mfd-all-checks`| Run all available checks. |
29
+
30
+
### Available arguments (for all commands)
31
+
32
+
*`-p` / `--project-dir` - path to the root directory (default: current working directory)
33
+
34
+
*`-v` / `--verbose` - enable verbose output
35
+
36
+
> [!NOTE]
37
+
> All commands are expected to be run from the root directory of the project.\
38
+
> Recommended file structure:
39
+
> ```
40
+
> <project>
41
+
> ├── <package>
42
+
> │ ├── __init__.py
43
+
> │ ├── ...
44
+
> ├── tests
45
+
> │ ├── system
46
+
> │ │ ├── __init__.py
47
+
> │ │ └── ...
48
+
> │ ├── unit
49
+
> │ │ ├── __init__.py
50
+
> │ │ └── ...
51
+
> │ └── __init__.py
52
+
> ├── pyproject.toml
53
+
> ├── README.md
54
+
> └── ...
55
+
> ```
41
56
42
-
> `mfd-help`\
43
-
Log available commands.
57
+
### Configuration files
44
58
45
-
> `mfd-format-code`\
46
-
Format code using ruff check --fix and ruff format
59
+
We are using 2 configuration files (created/modified/removed automatically):
47
60
48
-
All commands can be combined with `--project-dir` parameter, which should point to the root directory of your repository.
49
-
If this parameter is not given current working directory will be assumed to be root directory.
61
+
* `ruff.toml` - for ruff configuration
50
62
51
-
### Configuration files
52
-
We are using 3 configuration files:
53
-
-`ruff.toml` - for ruff configuration
54
-
-`pyproject.toml` - for project/generic configuration
55
-
-`.pre-commit-config.yaml` - for pre-commit configuration
63
+
* `pyproject.toml` - for project/generic configuration
56
64
57
65
### Custom configuration
66
+
58
67
Some modules have custom configuration files. Files are stored in `mfd_code_quality/code_standard/config_per_module` directory. Configuration files are merged with generic one during configuration process.
0 commit comments