From 71629d4cf888b322d082f1f094239a9f1bf02fec Mon Sep 17 00:00:00 2001 From: Mathias Laurin Date: Wed, 27 Nov 2024 15:06:32 +0100 Subject: [PATCH] bazelize mypy / cmk-rulesets Change-Id: I2b85c8db9a31399f54a1758a4da4abb1a45ee332 --- packages/cmk-rulesets/pyproject.toml | 33 ++-------------------------- packages/cmk-rulesets/run | 3 +-- pyproject.toml | 27 +++++++++++++++++++++++ 3 files changed, 30 insertions(+), 33 deletions(-) diff --git a/packages/cmk-rulesets/pyproject.toml b/packages/cmk-rulesets/pyproject.toml index 6a41472eaab..4709b625e1c 100644 --- a/packages/cmk-rulesets/pyproject.toml +++ b/packages/cmk-rulesets/pyproject.toml @@ -22,37 +22,8 @@ line-length = 100 [tool.ruff.lint.isort] order-by-type = false -[tool.mypy] -enable_error_code = [ - "explicit-override", - "ignore-without-code", - "mutable-override", - "possibly-undefined", - "redundant-expr", - "redundant-self", - "truthy-bool", - "truthy-iterable", - "unimported-reveal", - "unused-awaitable", - "unused-ignore", -] -explicit_package_bases = true -packages = ["cmk", "tests"] -strict = true -# Miscellaneous stuff not in --strict -disallow_any_decorated = false -disallow_any_explicit = false -disallow_any_expr = true -disallow_any_generics = true -disallow_any_unimported = true -disallow_subclassing_any = true -no_implicit_optional = true -strict_optional = true -warn_unreachable = true -# hidden flags for PEP 688 compat, see https://github.com/python/mypy/issues/15313 -disable_bytearray_promotion = true -disable_memoryview_promotion = true - +# [tool.mypy] +# mypy config moved to overrides in the root pyproject.toml [tool.pylint.format] max-line-length = 100 diff --git a/packages/cmk-rulesets/run b/packages/cmk-rulesets/run index 312f5c3d591..a71c9b5244a 100755 --- a/packages/cmk-rulesets/run +++ b/packages/cmk-rulesets/run @@ -138,8 +138,7 @@ run_check_format() { } run_mypy() { - setup_venv - mypy + "${BAZEL_CMD}" build --config=mypy //packages/cmk-agent-based:all } run_pylint() { diff --git a/pyproject.toml b/pyproject.toml index 22a2e434c01..b0e8b373d55 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -354,6 +354,33 @@ no_implicit_optional = true strict_optional = true warn_unreachable = true +[[tool.mypy.overrides]] +module = ["cmk.rulesets.*"] +enable_error_code = [ + "explicit-override", + "ignore-without-code", + "mutable-override", + "possibly-undefined", + "redundant-expr", + "redundant-self", + "truthy-bool", + "truthy-iterable", + "unimported-reveal", + "unused-awaitable", + "unused-ignore", +] +strict = true +# Miscellaneous stuff not in --strict +disallow_any_decorated = false +disallow_any_explicit = false +disallow_any_expr = true +disallow_any_generics = true +disallow_any_unimported = true +disallow_subclassing_any = true +no_implicit_optional = true +strict_optional = true +warn_unreachable = true + [[tool.mypy.overrides]] module = ["cmk.gui.form_specs.*"] disallow_any_generics = true