From 504d9d48cc6348caf00c6605bd3ac98cc1402440 Mon Sep 17 00:00:00 2001 From: Stefan Scherzinger Date: Wed, 30 Oct 2024 16:48:26 +0100 Subject: [PATCH] Add `mypy` to our pre-commit config Also use explicit hashes for pre-commit hooks. That's a little safer. --- .pre-commit-config.yaml | 9 +++++++-- .../integration_tests/integration_tests.py | 8 ++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c0354474..e86d1d59 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,15 +19,20 @@ repos: # Python - repo: https://github.com/pycqa/flake8 - rev: 6.0.0 + rev: '88a4f9b2f48fc44b025a48fa6a8ac7cc89ef70e0' # 7.0.0 hooks: - id: flake8 - repo: https://github.com/psf/black.git - rev: 23.7.0 + rev: '6fdf8a4af28071ed1d079c01122b34c5d587207a' # 24.2.0 hooks: - id: black + - repo: https://github.com/pre-commit/mirrors-mypy + rev: '9db9854e3041219b1eb619872a2dfaf58adfb20b' # v1.9.0 + hooks: + - id: mypy + # C++ - repo: local hooks: diff --git a/cartesian_controller_tests/integration_tests/integration_tests.py b/cartesian_controller_tests/integration_tests/integration_tests.py index 0fd733c2..a71e094b 100755 --- a/cartesian_controller_tests/integration_tests/integration_tests.py +++ b/cartesian_controller_tests/integration_tests/integration_tests.py @@ -272,11 +272,15 @@ def set_parameters(self, client: Client, params: list[Parameter]) -> None: req = SetParameters.Request() req.parameters = params future = client.call_async(req) - rclpy.spin_until_future_complete(self.node, future) + rclpy.spin_until_future_complete( + self.node, future # type: ignore[attr-defined] + ) def get_parameters(self, client: Client, names: list[str]) -> Any: req = GetParameters.Request() req.names = names future = client.call_async(req) - rclpy.spin_until_future_complete(self.node, future) + rclpy.spin_until_future_complete( + self.node, future # type: ignore[attr-defined] + ) return future.result()