From 13de866bbebcdb674530e0d2642572b0d41ee06f Mon Sep 17 00:00:00 2001 From: Shubham <52372631+skpawar1305@users.noreply.github.com> Date: Tue, 27 Feb 2024 14:39:41 +0100 Subject: [PATCH] use precommit checks (#23) --- .github/workflows/test_ros2_humble.yml | 33 ++++++++++++++++---------- .pre-commit-config.yaml | 20 ++++++++++++++++ LICENSE | 2 +- map/map.yaml | 2 +- map/map_arena3.yaml | 2 +- protos/ImageBox.proto | 2 +- protos/Spot.proto | 2 +- resource/moveit_controllers.yaml | 2 +- resource/moveit_kinematics.yaml | 2 +- resource/moveit_movegroup.yaml | 2 +- resource/webots_blocksworld.gpp | 2 +- worlds/spot.wbt | 2 +- 12 files changed, 51 insertions(+), 22 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.github/workflows/test_ros2_humble.yml b/.github/workflows/test_ros2_humble.yml index ee34ee3..5bfe3bd 100644 --- a/.github/workflows/test_ros2_humble.yml +++ b/.github/workflows/test_ros2_humble.yml @@ -3,31 +3,40 @@ name: ROS2 Humble on: pull_request: types: [opened, synchronize, reopened, labeled, unlabeled] + push: + branches: + - main schedule: - - cron: '0 02 * * *' + - cron: '0 10 * * *' concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: - code_quality: - name: Black Formatting - runs-on: ubuntu-22.04 + lint: + name: Lint package + runs-on: ubuntu-latest + strategy: + matrix: + config: + - { python: "3.10" } steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v2 + - name: Checkout repository + uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 with: - python-version: 3.x - - run: pip install --upgrade pip - - run: pip install "black<23" pylint==v3.0.0a3 mypy==v0.902 - - run: black --diff --check $(git ls-files '*.py') + python-version: ${{ matrix.config.python }} + + - name: Lint sources + uses: pre-commit/action@v3.0.1 webots_spot: name: Webots Spot with Nav2 and Moveit2 runs-on: ubuntu-22.04 steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install ROS2 Humble run: > sudo apt update @@ -81,4 +90,4 @@ jobs: export DEBIAN_FRONTEND=noninteractive cd ~/ros2_ws source install/setup.bash - colcon test --ctest-args tests --packages-select webots_spot --event-handlers console_direct+ --return-code-on-test-failure \ No newline at end of file + colcon test --ctest-args tests --packages-select webots_spot --event-handlers console_direct+ --return-code-on-test-failure diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..c95fc44 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,20 @@ +repos: +- repo: https://github.com/psf/black + rev: 23.3.0 + hooks: + - id: black + language_version: python3.10 + +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: check-yaml + - id: check-added-large-files + - id: end-of-file-fixer + +# - repo: https://github.com/pre-commit/mirrors-mypy +# rev: v1.2.0 +# hooks: +# - id: mypy +# types: [python] +# args: [--strict, --ignore-missing-imports] diff --git a/LICENSE b/LICENSE index 29ebfa5..0ad25db 100644 --- a/LICENSE +++ b/LICENSE @@ -658,4 +658,4 @@ specific requirements. You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see -. \ No newline at end of file +. diff --git a/map/map.yaml b/map/map.yaml index 91401a0..2ae38ed 100644 --- a/map/map.yaml +++ b/map/map.yaml @@ -4,4 +4,4 @@ resolution: 0.05 origin: [-1.22, -4.98, 0] negate: 0 occupied_thresh: 0.65 -free_thresh: 0.25 \ No newline at end of file +free_thresh: 0.25 diff --git a/map/map_arena3.yaml b/map/map_arena3.yaml index 0542934..554f518 100644 --- a/map/map_arena3.yaml +++ b/map/map_arena3.yaml @@ -4,4 +4,4 @@ resolution: 0.05 origin: [-1.61, -5.08, 0] negate: 0 occupied_thresh: 0.65 -free_thresh: 0.25 \ No newline at end of file +free_thresh: 0.25 diff --git a/protos/ImageBox.proto b/protos/ImageBox.proto index 8a9756e..4f19138 100644 --- a/protos/ImageBox.proto +++ b/protos/ImageBox.proto @@ -56,4 +56,4 @@ PROTO ImageBox [ name IS name model "imagebox" } -} \ No newline at end of file +} diff --git a/protos/Spot.proto b/protos/Spot.proto index 51e5320..dfdf044 100644 --- a/protos/Spot.proto +++ b/protos/Spot.proto @@ -935,4 +935,4 @@ PROTO Spot [ synchronization IS synchronization selfCollision IS selfCollision } -} \ No newline at end of file +} diff --git a/resource/moveit_controllers.yaml b/resource/moveit_controllers.yaml index 9a8a1ce..0c23508 100644 --- a/resource/moveit_controllers.yaml +++ b/resource/moveit_controllers.yaml @@ -21,4 +21,4 @@ tiago_gripper_joint_trajectory_controller: default: true joints: - gripper_left_finger_joint - - gripper_right_finger_joint \ No newline at end of file + - gripper_right_finger_joint diff --git a/resource/moveit_kinematics.yaml b/resource/moveit_kinematics.yaml index 4fd5836..74d8556 100644 --- a/resource/moveit_kinematics.yaml +++ b/resource/moveit_kinematics.yaml @@ -1,4 +1,4 @@ spot_arm: kinematics_solver: kdl_kinematics_plugin/KDLKinematicsPlugin kinematics_solver_search_resolution: 0.5 - kinematics_solver_timeout: 0.5 \ No newline at end of file + kinematics_solver_timeout: 0.5 diff --git a/resource/moveit_movegroup.yaml b/resource/moveit_movegroup.yaml index 99b4a9b..36c2c76 100644 --- a/resource/moveit_movegroup.yaml +++ b/resource/moveit_movegroup.yaml @@ -7,4 +7,4 @@ request_adapters: >- default_planner_request_adapters/FixWorkspaceBounds default_planner_request_adapters/FixStartStateBounds default_planner_request_adapters/FixStartStateCollision - default_planner_request_adapters/FixStartStatePathConstraints \ No newline at end of file + default_planner_request_adapters/FixStartStatePathConstraints diff --git a/resource/webots_blocksworld.gpp b/resource/webots_blocksworld.gpp index c6c281d..88794bc 100644 --- a/resource/webots_blocksworld.gpp +++ b/resource/webots_blocksworld.gpp @@ -65,4 +65,4 @@ procedure main() { pick (block x in {a, b, c}) pick(location y in {t1, t2, t3, a, b, c}) stack(x, y); -} \ No newline at end of file +} diff --git a/worlds/spot.wbt b/worlds/spot.wbt index 91594f8..1e8fce1 100644 --- a/worlds/spot.wbt +++ b/worlds/spot.wbt @@ -768,4 +768,4 @@ DEF BLUE_3 SolidBox { } physics Physics { } -} \ No newline at end of file +}