From 3d74f75009cd24488c27fa01588892dce3273af6 Mon Sep 17 00:00:00 2001 From: Jakub Delicat <109142865+delihus@users.noreply.github.com> Date: Wed, 27 Dec 2023 10:17:40 +0100 Subject: [PATCH] Add precommit (#7) * Added precommit Signed-off-by: Jakub Delicat * added config file Signed-off-by: Jakub Delicat * update * update --------- Signed-off-by: Jakub Delicat Co-authored-by: rafal-gorecki --- .github/workflows/ros-docker-image.yaml | 30 +++++----- .../workflows/vulcanexus-docker-image.yaml | 32 ++++++----- .pre-commit-config.yaml | 56 +++++++++++++++++++ demo/default.rviz | 2 +- 4 files changed, 92 insertions(+), 28 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.github/workflows/ros-docker-image.yaml b/.github/workflows/ros-docker-image.yaml index 6308d88..fed6842 100644 --- a/.github/workflows/ros-docker-image.yaml +++ b/.github/workflows/ros-docker-image.yaml @@ -1,28 +1,32 @@ -name: Build/Publish ROS Docker Image +--- +name: Build/Publish ROS Docker Image -on: +on: workflow_dispatch: inputs: build_type: - description: "Is it a \"development\" or a \"stable\" release?" + description: Is it a "development" or a "stable" release? required: true - default: 'development' + default: development type: choice options: - development - stable target_distro: - description: "In case of \"stable\" release specify the ROS distro of the existing docker image (eg. humble)" + description: In case of "stable" release specify the ROS distro of the existing docker image (eg. + humble) type: string - default: "ardent" + default: ardent target_release: - description: "In case of \"stable\" release specify the version of the existing docker image (eg. 1.0.12)" + description: In case of "stable" release specify the version of the existing docker image (eg. + 1.0.12) type: string - default: "0.0.0" + default: 0.0.0 target_date: - description: "In case of \"stable\" release specify the date of the existing docker image in format YYYYMMDD (eg. 20220124)" + description: In case of "stable" release specify the date of the existing docker image in format + YYYYMMDD (eg. 20220124) type: string - default: "20131206" + default: '20131206' repository_dispatch: types: [rebuild] pull_request: @@ -36,7 +40,7 @@ jobs: strategy: fail-fast: false matrix: - ros_distro: ["iron", "humble"] + ros_distro: [iron, humble] steps: @@ -47,11 +51,11 @@ jobs: uses: husarion-ci/ros-docker-img-action@v0.4 with: dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} - dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }} + dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }} main_branch_name: ros2 build_type: ${{ inputs.build_type }} ros_distro: ${{ matrix.ros_distro }} - platforms: "linux/amd64, linux/arm64" + platforms: linux/amd64, linux/arm64 # variables important only for stable release target_distro: ${{ inputs.target_distro }} target_release: ${{ inputs.target_release }} diff --git a/.github/workflows/vulcanexus-docker-image.yaml b/.github/workflows/vulcanexus-docker-image.yaml index ea96290..428d749 100644 --- a/.github/workflows/vulcanexus-docker-image.yaml +++ b/.github/workflows/vulcanexus-docker-image.yaml @@ -1,28 +1,32 @@ -name: Build/Publish Vulcanexus Docker Image +--- +name: Build/Publish Vulcanexus Docker Image -on: +on: workflow_dispatch: inputs: build_type: - description: "Is it a \"development\" or a \"stable\" release?" + description: Is it a "development" or a "stable" release? required: true - default: 'development' + default: development type: choice options: - development - stable target_distro: - description: "In case of \"stable\" release specify the ROS distro of the existing docker image (eg. humble)" + description: In case of "stable" release specify the ROS distro of the existing docker image (eg. + humble) type: string - default: "ardent" + default: ardent target_release: - description: "In case of \"stable\" release specify the version of the existing docker image (eg. 1.0.12)" + description: In case of "stable" release specify the version of the existing docker image (eg. + 1.0.12) type: string - default: "0.0.0" + default: 0.0.0 target_date: - description: "In case of \"stable\" release specify the date of the existing docker image in format YYYYMMDD (eg. 20220124)" + description: In case of "stable" release specify the date of the existing docker image in format + YYYYMMDD (eg. 20220124) type: string - default: "20131206" + default: '20131206' repository_dispatch: types: [rebuild] pull_request: @@ -36,7 +40,7 @@ jobs: strategy: fail-fast: false matrix: - ros_distro: ["humble"] + ros_distro: [humble] steps: @@ -47,12 +51,12 @@ jobs: uses: husarion-ci/ros-docker-img-action@v0.4 with: dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} - dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }} + dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }} main_branch_name: ros2 build_type: ${{ inputs.build_type }} ros_distro: ${{ matrix.ros_distro }} - platforms: "linux/amd64, linux/arm64" - prefix: "vulcanexus-" + platforms: linux/amd64, linux/arm64 + prefix: vulcanexus- # variables important only for stable release target_distro: ${{ inputs.target_distro }} target_release: ${{ inputs.target_release }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..cf03b95 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,56 @@ +--- +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: check-merge-conflict + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-xml + - id: check-added-large-files + - id: check-ast + - id: check-json + - id: name-tests-test + files: ^.*\/test\/.*$ + args: [--pytest-test-first] + + - repo: https://github.com/codespell-project/codespell + rev: v2.2.6 + hooks: + - id: codespell + entry: codespell * + + - repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt + rev: 0.2.3 + hooks: + - id: yamlfmt + files: ^(?!.*compose).*$ + args: [--mapping, '2', --sequence, '4', --offset, '2', --width, '100'] + + + - repo: https://github.com/psf/black + rev: 23.12.0 + hooks: + - id: black + args: [--line-length=99] + + - repo: https://github.com/PyCQA/flake8 + rev: 6.1.0 + hooks: + - id: flake8 + args: ['--ignore=E501,W503'] # ignore too long line and line break before binary operator, + # black checks it + + # Docs - RestructuredText hooks + - repo: https://github.com/PyCQA/doc8 + rev: v1.1.1 + hooks: + - id: doc8 + args: [--max-line-length=100, --ignore=D001] + exclude: ^.*\/CHANGELOG\.rst/.*$ + + - repo: https://github.com/pre-commit/mirrors-clang-format + rev: v17.0.6 + hooks: + - id: clang-format diff --git a/demo/default.rviz b/demo/default.rviz index eb63647..2fe6850 100644 --- a/demo/default.rviz +++ b/demo/default.rviz @@ -164,4 +164,4 @@ Window Geometry: collapsed: false Width: 1200 X: 321 - Y: 92 \ No newline at end of file + Y: 92