forked from Checkmk/checkmk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
178 lines (163 loc) · 7.15 KB
/
pyproject.toml
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
[tool.ruff]
src = ["cmk", "tests"]
target-version = "py311"
ignore = [
"E402", # module level import not on top of the file
"E501", # line too long, 100s of fails. Fixable.
"E731", # Do not assign a `lambda` expression, use a `def`
"E741", # amgiguous variable name (l, x, etc.)
"E713", # Test for membership should be `not in`
"E999", # SyntaxError, all due to missing "match" support in ruff. See: https://github.com/charliermarsh/ruff/issues/282
"S101", # assert detected
# Ignored in .flake8 but not here.
# F403 undefined imports, all are fixed now, but we shouldn't add new ones.
# F405 are * imports. We shouldn't do those.
]
select = ["E", "F", "YTT"]
# Interesting to enable:
# "RUF" - Remove unused "noqa" directives from the code, etc.
# "TRY" - remove those "raise Exception" calls. 1688 failures.
# "G" - wrong logging.log formattion! 107 failures
# "S" - emulate bandit. 12993 errors detected. Ignoring complaints about asserts, 335 failures remain.
# "PGH" - complain about blanket "type: ignore" without specifics.
# "T20" - complain about print found. 217 "failures" found. Needs some rework first!
# "DTZ" - disallows datetime objects without timezone, 254 failures.
# "UP" - emulate pyupgrade. 3024 failures, 3005 fixable automatically.
# "C4" - simplify comprehensions, 164 failures, 138 auto fixable
# "B" - bugbear, 756 failures, 71 auto fixable
# "ERA" - commented out code, 1717 failures, 1717 auto fixable
# "PL" - impersonate PyLint. 2819 failures, 1 auto fixable.
# "ARG" - unused arguments, 3358 failures
# "I" - replaces isort, but doesn't honor isort disable annotation yet, only "noqa: I001"
# "D" - enforces docstring writing style. Ignore "D10,D4" for now.
# "COM" - enforce trailing comma. Lots of matches.
unfixable = [
"F401", # pylint: disable=unused-import. Clean up by hand.
]
[per-file-ignores]
"cmk/gui/config.py" = ["F403", "F405"]
[flake8-annotations]
suppress-dummy-args = true
[mccabe]
max-complexity = 15
[tool.isort]
known_testlib = "tests.testlib"
known_compositiontests = "tests.composition"
known_unittests = "tests.unit"
known_livestatus = "livestatus"
known_omd = "omdlib"
known_cmk_utils = "cmk.utils"
known_cmk_automations = "cmk.automations"
known_cmk_base = "cmk.base"
known_cmc_proto = "cmc_proto"
known_cmk_ec = "cmk.ec"
known_cmk_gui = "cmk.gui"
known_cmk_cee = "cmk.cee.dcd,cmk.cee.liveproxy,cmk.cee.mknotifyd"
known_cmk_notification_plugins = "cmk.notification_plugins"
known_cmk_snmplib = "cmk.snmplib"
known_cmk_fetchers = "cmk.fetchers"
known_cmk_checkengine = "cmk.checkengine"
known_first_party = "cmk"
# Order sections according to our layering.
sections = """FUTURE,STDLIB,THIRDPARTY,CMC_PROTO,TESTLIB,COMPOSITIONTESTS,UNITTESTS,LIVESTATUS,OMD,
CMK_UTILS,CMK_AUTOMATIONS,CMK_SNMPLIB,CMK_FETCHERS,CMK_CHECKENGINE,CMK_BASE,CMK_EC,CMK_GUI,CMK_CEE,
CMK_NOTIFICATION_PLUGINS,FIRSTPARTY,LOCALFOLDER"""
# configuration options compatible with black
multi_line_output = 3
include_trailing_comma = "True"
force_grid_wrap = 0
use_parentheses = "True"
ensure_newline_before_comments = "True"
order_by_type = "False"
line_length = 100
py_version = "311"
[tool.black]
line-length = 100
target-version = ['py311']
# NOTE: Keep this is sync with mypy-raw.ini!
# The number of errors/files below are just a snapshot to give a rough idea. In
# addition, a single cause can imply multiple symptoms, so these numbers have to
# be taken with a grain of salt...
[tool.mypy]
plugins = ["pydantic.mypy"]
# When all of these are true, we can enable --strict
check_untyped_defs = true
disallow_any_generics = false # 1904 errors in 507 files
disallow_incomplete_defs = true
disallow_subclassing_any = false # 11 errors in 10 files
disallow_untyped_calls = false # 6427 errors in 1077 files
disallow_untyped_decorators = true
disallow_untyped_defs = false # 6738 errors in 1571
no_implicit_optional = true
no_implicit_reexport = true
strict_concatenate = true
strict_equality = true
warn_redundant_casts = true
warn_return_any = false # 622 errors in 267 files
warn_unused_configs = true
warn_unused_ignores = false # 25 errors in 8 files
# Miscellaneous stuff not in --strict
disallow_any_decorated = false # 3433 errors in 997 files
disallow_any_explicit = false # 2854 errors in 836 files
disallow_any_expr = false # 112427 errors in 3304 files
disallow_any_unimported = false # 291 errors in 46 files
warn_unreachable = false # 240 errors in 133 files
# hidden flags for PEP 688 compat, see https://github.com/python/mypy/issues/15313
disable_bytearray_promotion = true
disable_memoryview_promotion = true
[[tool.mypy.overrides]]
module = [
"cmk.cee.bakery.*",
"cmk.gui.background_job",
"cmk.gui.backup.backup",
"cmk.gui.mobile.views",
"cmk.gui.plugins.wato.bi_config",
"cmk.gui.plugins.wato.utils.main_menu",
"cmk.gui.views.layout",
"cmk.gui.wato.pages.bulk_discovery",
"cmk.gui.wato.pages.bulk_edit",
"cmk.gui.wato.pages.folders",
"cmk.gui.wato.pages.parentscan",
"cmk.gui.watolib.bulk_discovery",
"cmk.gui.watolib.main_menu",
"cmk.gui.watolib.network_scan",
"cmk.notification_plugins.*",
"cmk.update_config.*",
"cmk.utils.crypto.*",
"tests.gui_e2e.*",
"tests.testlib.*",
"tests.unit.cmk.ec.*",
"tests.unit.cmk.update_config.*",
]
disallow_untyped_calls = true
disallow_untyped_defs = true
warn_return_any = true
warn_unused_ignores = true
[tool.pydantic-mypy]
init_forbid_extra = true
init_typed = true
warn_required_dynamic_aliases = true
warn_untyped_fields = true
[tool.pytest.ini_options]
testpaths = ["tests"]
# --durations=20: Show the 20 slowest tests
addopts = "--log-cli-level=INFO --log-cli-format=\"%(asctime)s %(levelname)s %(message)s\" -rs --durations=20"
markers = ["checks: Run all existing test cases for checks."]
# See: https://docs.python.org/3/library/warnings.html#the-warnings-filter
filterwarnings = [
# Breaking change, only in new major version, see https://github.com/marshmallow-code/apispec/pull/759
'ignore:^distutils Version classes are deprecated\. Use packaging.version instead\.$:DeprecationWarning:apispec.utils:0',
# Internal copy of distutils in setuptools :-P
'ignore:^distutils Version classes are deprecated\. Use packaging.version instead\.$:DeprecationWarning:distutils.version:0',
# pysnmp uses the dprecated asyncore module
'ignore:^The asyncore module is deprecated and will be removed in Python 3.12. The recommended replacement is asyncio$:DeprecationWarning',
# We have a doctest which intentionally checks for a failure
'ignore:^Invalid value for tag-group tag_agent. None$:UserWarning:cmk.gui.fields.definitions:0',
# The ReportLab package uses deprecated features, see: https://github.com/Distrotech/reportlab/blob/master/src/reportlab/__init__.py
'ignore:^the load_module\(\) method is deprecated and slated for removal in Python 3.12; use exec_module\(\) instead$:DeprecationWarning',
# Make marshmallow warnings errors, otherwise typos may go unnoticed.
'error::marshmallow.warnings.RemovedInMarshmallow4Warning',
]
# When writing a junit.xml, also write the output of a test to the junit
# file in addition to the console.
junit_logging = "all"