-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtox.ini
48 lines (37 loc) · 2.33 KB
/
tox.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# tox.ini :it provide the local env
# for testing your application on different python version in local (python=3.10,python=3.9 ahnd so on)
[tox]
envlist = python3.7, python3.8, python3.9
[gh-actions]
python =
3.7: python3.7
3.8: python3.8
3.9: python3.9
[testenv]
deps = -r requirements_dev.txt
commands =
# stop the build if there are Python syntax errors or undefined names
flake8 src --count --select=E9,F63,F7,F82 --show-source --statistics
# --count or -c are the command line argument
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 src --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
# type linting
mypy src/
# pytest unit
pytest -v tests/unit
# pytest integration
pytest -v tests/integration
'''
--count: This option makes Flake8 display the total number of errors found.
--select: This option specifies which categories of errors to select. In this case, it selects errors related to:
this are python protocal
E9: SyntaxError.
F63: Fix using '==' to compare exact type.
F7: Assignment of lambda expression.
F82: Using a variable only once.
--show-source: This option displays the source code for each reported error.
--statistics: This option provides statistics about the number of files checked and the total number of errors found.
--exit-zero: This option tells Flake8 to exit with a status code of zero even if it finds errors. It means that the command will return a successful exit code (0) even if there are linting errors, which can be useful in certain contexts like CI pipelines where the goal might be to collect and report errors rather than failing the build.
--max-complexity=10: This option sets the maximum McCabe complexity threshold to 10. McCabe complexity is a measure of the complexity of a function based on the number of linearly independent paths through the functions control flow graph. This option ensures that functions with a complexity greater than 10 will be flagged as potential issues.
--max-line-length=127: This option sets the maximum allowed line length to 127 characters. PEP 8 recommends keeping lines to a maximum of 79 characters, but this option allows for longer lines up to 127 characters. It is useful for projects with longer line length requirements or for handling long URLs or data literals.
'''