From e787a532de7dfcdec783be68fe81dcc705fe9bf3 Mon Sep 17 00:00:00 2001 From: Benedikt Mersch Date: Wed, 16 Oct 2024 15:35:18 +0200 Subject: [PATCH] Add python checks to pre-commit (#9) * Add black and isort * Format * use black for isort --- .pre-commit-config.yaml | 9 +++++++++ ros/launch/offline_node.launch.py | 3 +-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 37cfe77..304ae26 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,7 +12,16 @@ repos: rev: v14.0.0 hooks: - id: clang-format +- repo: https://github.com/psf/black + rev: 23.1.0 + hooks: + - id: black - repo: https://github.com/ahans/cmake-format-precommit rev: 8e52fb6506f169dddfaa87f88600d765fca48386 hooks: - id: cmake-format +- repo: https://github.com/pycqa/isort + rev: 5.12.0 + hooks: + - id: isort + args: ["--profile", "black", "--filter-files"] diff --git a/ros/launch/offline_node.launch.py b/ros/launch/offline_node.launch.py index 371d8bb..bd66551 100644 --- a/ros/launch/offline_node.launch.py +++ b/ros/launch/offline_node.launch.py @@ -4,14 +4,13 @@ import launch from ament_index_python.packages import get_package_share_directory from launch import LaunchDescription -from launch.actions import OpaqueFunction +from launch.actions import DeclareLaunchArgument, OpaqueFunction from launch.conditions import IfCondition from launch.launch_description_sources import ( get_launch_description_from_python_launch_file, ) from launch.substitutions import LaunchConfiguration from launch_ros.actions import Node -from launch.actions import DeclareLaunchArgument def _generate_launch_description(context: launch.LaunchContext, *args, **kwargs):