-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.cfg
100 lines (91 loc) · 4.31 KB
/
setup.cfg
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
[flake8]
# Base flake8 configuration:
# https://flake8.pycqa.org/en/latest/user/configuration.html
format = wemake
show-source = True
statistics = True
doctests = True
enable-extensions = G
strictness = long
# Plugins:
accept-encodings = utf-8
max-complexity = 8
max-line-length = 79
max-local-variables = 6
radon-max-cc = 10
radon-show-closures = True
radon-no-assert = True
# Excluding some directories:
exclude =
.git
__pycache__
.venv
.eggs
*.egg
tests/fixtures/
# Exclude some pydoctest checks globally.
# WPS305 because I love f-string
# N803, N806 because I'd like to use CAPITALIZED variables to indicate config-related values
# G004 because I love f-string in logging
# G001 because sometimes f-string is too long and I have to switch to format string in logging.
# S608 because table name cannot be the target of param substitution, and thus has to be incorporated using string formatting.
# WPS420 because sometimes I need to use `pass` as placeholder
# WPS430 because nested function is useful when lambda cannot cut it to create small throw-away functions.
# WPS111 because lambda function is allowed to use short, single-letter variable.
# WPS323 because percent string formatting is required to handle datetime parsing and logger formatting
# WPS326 because implicity string concatenation is needed for long string to stay within 79 characters limit.
# S603 because it is too strict on checking `subprocess` calls (see https://github.com/PyCQA/bandit/issues/333)
# S602 because I need to use `shell=True` for complex shell command
# S001 because false positive. Supposed to have been fixed (https://github.com/gforcada/flake8-pep3101/issues/21), but I still get false positive. I don't use modulo formatter anyway
# S404 because I need to use subprocess from time to time.
# RST213 because inline emphasis start-string messes up with docstring inclusion of *args and **kwargs.
ignore =
D100, D104, D401,
W504,
RST303, RST304, RST213
WPS305, WPS420, WPS430, WPS111, WPS323, WPS326
N803, N806,
G004, G001
S608, S602, S603, S001, S404
per-file-ignores =
# ignore S101 to allow the use of assert in test files
# ignore WPS442 to allow name shadowing for pytest.fixture
# ignore E501 to allow long string comparison in tests.
# ignore WPS432 to allow the use of magic number in setting up test input and expected
# ignore WPS226 to allow the string reuse in setting up test input and expected
# ignore WPS202 to allow arbitrary number of functions or test cases in a test module
# ignore WPS210 to allow arbitrary number of local variables in a test function
# ignore WPS204 to allow one to repeat the same expression over and over again in a test module
# ignore WPS211 to allow for arbitrary number of arguments in test or test fixture functions.
# ignore WPS437 to allow testing on protected attributes (i.e. member name starting with underscore)
# ignore WPS431 to allow mocking of classes in pytest fixture.
# ignore WPS506 to allow all kinds of lambda function usage in monkeypatch.
tests/*.py: S101, WPS442, E501, WPS432, WPS226, WPS202, WPS210, WPS204, WPS211, WPS437, WPS431, WPS506
# ignore WPS431 because pydantic requires nexted class
config.py: WPS431
# ignore S311 because pseudo-random number is used for demo purpose.
src/vehicle_detector/detect_vehicle.py: S311
# ignore E501 because lambda function might involve long conditional statement that is better left in one line
# ignore WPS202 because it is easier to maintain lambda function when it contains all the modules, as long as the number of modules is not too crazy
# ignore WPS226 because there are a lot of return messages requiring repeated use of certain strings. It will be a huge clutter if all the over-used strings need their own variable names.
# ignore WPS231 because the high cognitive complexity is due to the validation function, which has to contain a lot of complex if statements.
src/lambda_func/**/*.py: E501, WPS202, WPS226, WPS231
[isort]
include_trailing_comma = True
multi_line_output = 3
use_parentheses = True
line_length = 79
known_future_library = ["future", "pies"]
known_third_party = AWSIoTPythonSDK,boto3,pydantic,script_config
indent = " "
force_grid_wrap= 0
[darglint]
docstring_style=sphinx
strictness=long
[coverage:run]
branch=true
[tool:pytest]
xfail_strict=true
[mypy]
ignore_missing_imports=True
python_version=3.7