From 2961d5049c5490a7922847fee726c907f1e5bd5d Mon Sep 17 00:00:00 2001 From: Felix Exner Date: Mon, 22 Apr 2024 14:18:28 +0200 Subject: [PATCH] Update pre-commit workflow --- .github/workflows/pre-commit.yml | 19 ++++----- .pre-commit-config.yaml | 26 ++---------- .../launch/rsp.launch.py | 23 ++++++----- .../launch/start_robot.launch.py | 4 +- .../launch/view_robot.launch.py | 41 ++++++++++--------- .../launch/move_group.launch.py | 4 +- .../launch/moveit_rviz.launch.py | 4 +- .../launch/setup_assistant.launch.py | 4 +- ur_documentation/docs/source/conf.py | 3 +- .../my_robot_cell/build_moveit_config.rst | 2 +- 10 files changed, 59 insertions(+), 71 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 18951de..72de092 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -3,17 +3,16 @@ name: pre-commit on: pull_request: jobs: - pre-commits: + pre-commit: name: pre-commit - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: - python-version: 3.9.7 - - name: "Install dependencies" - run: | - python -m pip install catkin_lint - - uses: pre-commit/action@v2.0.3 + python-version: "3.10" + - uses: actions/cache@v4 with: - extra_args: --all-files --hook-stage manual + path: ~/.cache/pre-commit + key: pre-commit-3|${{ hashFiles('.pre-commit-config.yaml') }} + - uses: pre-commit/action@v3.0.1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7ffa7e2..7d0a411 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ --- repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.3.0 + rev: v4.6.0 hooks: - id: check-added-large-files - id: check-docstring-first @@ -12,34 +12,14 @@ repos: - id: mixed-line-ending - id: trailing-whitespace - repo: https://github.com/psf/black - rev: 21.12b0 + rev: 24.4.0 hooks: - id: black args: ["--line-length=100"] - # Cmake hooks - - repo: local - hooks: - - id: ament_lint_cmake - name: ament_lint_cmake - description: Check format of CMakeLists.txt files. - stages: [commit] - entry: ament_lint_cmake - language: system - files: CMakeLists.txt$ - - # Copyright - - repo: local - hooks: - - id: ament_copyright - name: ament_copyright - description: Check if copyright notice is available in all files. - stages: [commit] - entry: ament_copyright - language: system # Spellcheck in comments and docs # skipping of *.svg files is not working... - repo: https://github.com/codespell-project/codespell - rev: v2.0.0 + rev: v2.2.6 hooks: - id: codespell args: ['--write-changes'] diff --git a/my_robot_cell/my_robot_cell_control/launch/rsp.launch.py b/my_robot_cell/my_robot_cell_control/launch/rsp.launch.py index 5af617f..59823a2 100644 --- a/my_robot_cell/my_robot_cell_control/launch/rsp.launch.py +++ b/my_robot_cell/my_robot_cell_control/launch/rsp.launch.py @@ -58,10 +58,13 @@ def generate_launch_description(): [ PathJoinSubstitution([FindExecutable(name="xacro")]), " ", - PathJoinSubstitution([ - FindPackageShare("my_robot_cell_control"), - "urdf", - "my_robot_cell_controlled.urdf.xacro"]), + PathJoinSubstitution( + [ + FindPackageShare("my_robot_cell_control"), + "urdf", + "my_robot_cell_controlled.urdf.xacro", + ] + ), " ", "robot_ip:=", robot_ip, @@ -113,12 +116,12 @@ def generate_launch_description(): DeclareLaunchArgument( "kinematics_parameters_file", default_value=PathJoinSubstitution( - [ - FindPackageShare("my_robot_cell_control"), - "config", - "my_robot_calibration.yaml", - ] - ), + [ + FindPackageShare("my_robot_cell_control"), + "config", + "my_robot_calibration.yaml", + ] + ), description="The calibration configuration of the actual robot used.", ) ) diff --git a/my_robot_cell/my_robot_cell_control/launch/start_robot.launch.py b/my_robot_cell/my_robot_cell_control/launch/start_robot.launch.py index 2cdb219..ea282ed 100644 --- a/my_robot_cell/my_robot_cell_control/launch/start_robot.launch.py +++ b/my_robot_cell/my_robot_cell_control/launch/start_robot.launch.py @@ -39,8 +39,8 @@ def generate_launch_description(): declared_arguments.append( DeclareLaunchArgument( "robot_ip", - default_value="192.168.56.101", # put your robot's IP address here - description="IP address by which the robot can be reached." + default_value="192.168.56.101", # put your robot's IP address here + description="IP address by which the robot can be reached.", ) ) diff --git a/my_robot_cell/my_robot_cell_description/launch/view_robot.launch.py b/my_robot_cell/my_robot_cell_description/launch/view_robot.launch.py index 107c32e..02b13ac 100644 --- a/my_robot_cell/my_robot_cell_description/launch/view_robot.launch.py +++ b/my_robot_cell/my_robot_cell_description/launch/view_robot.launch.py @@ -8,33 +8,34 @@ def generate_launch_description(): description_package = FindPackageShare("my_robot_cell_description") - description_file = PathJoinSubstitution([description_package, "urdf", "my_robot_cell.urdf.xacro"]) + description_file = PathJoinSubstitution( + [description_package, "urdf", "my_robot_cell.urdf.xacro"] + ) rvizconfig_file = PathJoinSubstitution([description_package, "rviz", "urdf.rviz"]) - robot_description = ParameterValue(Command(['xacro ', description_file, " ", "ur_type:=", "ur20"]), - value_type=str) + robot_description = ParameterValue( + Command(["xacro ", description_file, " ", "ur_type:=", "ur20"]), value_type=str + ) robot_state_publisher_node = Node( - package='robot_state_publisher', - executable='robot_state_publisher', - parameters=[{'robot_description': robot_description}] - ) + package="robot_state_publisher", + executable="robot_state_publisher", + parameters=[{"robot_description": robot_description}], + ) joint_state_publisher_gui_node = Node( - package='joint_state_publisher_gui', - executable='joint_state_publisher_gui', - ) + package="joint_state_publisher_gui", + executable="joint_state_publisher_gui", + ) rviz_node = Node( - package='rviz2', - executable='rviz2', - name='rviz2', - output='screen', - arguments=['-d', rvizconfig_file], + package="rviz2", + executable="rviz2", + name="rviz2", + output="screen", + arguments=["-d", rvizconfig_file], ) - return LaunchDescription([ - joint_state_publisher_gui_node, - robot_state_publisher_node, - rviz_node - ]) + return LaunchDescription( + [joint_state_publisher_gui_node, robot_state_publisher_node, rviz_node] + ) diff --git a/my_robot_cell/my_robot_cell_moveit_config/launch/move_group.launch.py b/my_robot_cell/my_robot_cell_moveit_config/launch/move_group.launch.py index 81c013d..b4c36d1 100644 --- a/my_robot_cell/my_robot_cell_moveit_config/launch/move_group.launch.py +++ b/my_robot_cell/my_robot_cell_moveit_config/launch/move_group.launch.py @@ -3,5 +3,7 @@ def generate_launch_description(): - moveit_config = MoveItConfigsBuilder("my_robot_cell", package_name="my_robot_cell_moveit_config").to_moveit_configs() + moveit_config = MoveItConfigsBuilder( + "my_robot_cell", package_name="my_robot_cell_moveit_config" + ).to_moveit_configs() return generate_move_group_launch(moveit_config) diff --git a/my_robot_cell/my_robot_cell_moveit_config/launch/moveit_rviz.launch.py b/my_robot_cell/my_robot_cell_moveit_config/launch/moveit_rviz.launch.py index 9fbae6c..f701508 100644 --- a/my_robot_cell/my_robot_cell_moveit_config/launch/moveit_rviz.launch.py +++ b/my_robot_cell/my_robot_cell_moveit_config/launch/moveit_rviz.launch.py @@ -3,5 +3,7 @@ def generate_launch_description(): - moveit_config = MoveItConfigsBuilder("my_robot_cell", package_name="my_robot_cell_moveit_config").to_moveit_configs() + moveit_config = MoveItConfigsBuilder( + "my_robot_cell", package_name="my_robot_cell_moveit_config" + ).to_moveit_configs() return generate_moveit_rviz_launch(moveit_config) diff --git a/my_robot_cell/my_robot_cell_moveit_config/launch/setup_assistant.launch.py b/my_robot_cell/my_robot_cell_moveit_config/launch/setup_assistant.launch.py index 6a9cf5a..d3d8f9c 100644 --- a/my_robot_cell/my_robot_cell_moveit_config/launch/setup_assistant.launch.py +++ b/my_robot_cell/my_robot_cell_moveit_config/launch/setup_assistant.launch.py @@ -3,5 +3,7 @@ def generate_launch_description(): - moveit_config = MoveItConfigsBuilder("my_robot_cell", package_name="my_robot_cell_moveit_config").to_moveit_configs() + moveit_config = MoveItConfigsBuilder( + "my_robot_cell", package_name="my_robot_cell_moveit_config" + ).to_moveit_configs() return generate_setup_assistant_launch(moveit_config) diff --git a/ur_documentation/docs/source/conf.py b/ur_documentation/docs/source/conf.py index 5393efe..6d77232 100644 --- a/ur_documentation/docs/source/conf.py +++ b/ur_documentation/docs/source/conf.py @@ -40,8 +40,7 @@ # ones. extensions = [ "sphinx.ext.todo", - 'sphinx_rtd_theme', - + "sphinx_rtd_theme", ] # Add any paths that contain templates here, relative to this directory. diff --git a/ur_documentation/docs/source/examples/my_robot_cell/build_moveit_config.rst b/ur_documentation/docs/source/examples/my_robot_cell/build_moveit_config.rst index bfa3aae..736bb8d 100644 --- a/ur_documentation/docs/source/examples/my_robot_cell/build_moveit_config.rst +++ b/ur_documentation/docs/source/examples/my_robot_cell/build_moveit_config.rst @@ -31,7 +31,7 @@ joints are in the 0 position. Hence, the collision is allowed as "Collision by d that tick, since we don't want that collision to be ignored. .. image:: self_collisions.png - :alt: Adjust self-collisions - Remove the tick for the collsion between monitor and ur20_upper_arm_link. + :alt: Adjust self-collisions - Remove the tick for the collision between monitor and ur20_upper_arm_link. We skip adding virtual joints for now and continue with our **planning group(s)**.