From 8bbf5b7a16fbcc98d5019dcd62e10b17fc2f6e1f Mon Sep 17 00:00:00 2001 From: Woen-Sug Choi Date: Fri, 28 Jun 2024 19:26:27 +0900 Subject: [PATCH 1/2] workflow lint check fix --- .github/workflows/lint.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d2866f36..9bebf897 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -7,6 +7,9 @@ on: tags: ["*"] branches: - ros2 + pull_request: + branches: + - ros2 jobs: # ament_lint: @@ -66,7 +69,7 @@ jobs: - name: Run Yamllint on YAML and .launch files run: | - find . \( -iname '*.yml' -o -iname '*.yaml' \) -print0 | xargs -0 yamllint + find . \( -iname '*.yml' -o -iname '*.yaml' \) -print0 | xargs -0 yamllint -d "{extends: relaxed, rules: {new-line-at-end-of-file: {present: false}}}" - name: Lint CMake files run: find . \( -iname 'CMakeLists.txt' -o -iname '*.cmake' \) -print0 | xargs -0 cmake-lint From 7c8baba64857cac181014437a299524387d5fe42 Mon Sep 17 00:00:00 2001 From: Woen-Sug Choi Date: Fri, 28 Jun 2024 21:28:12 +0900 Subject: [PATCH 2/2] yaml lint fix --- .github/workflows/lint.yml | 13 ++++++++----- .pre-commit-config.yaml | 30 ++++++++++++++++++------------ 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 9bebf897..48ca25a8 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -7,9 +7,6 @@ on: tags: ["*"] branches: - ros2 - pull_request: - branches: - - ros2 jobs: # ament_lint: @@ -62,14 +59,20 @@ jobs: - name: Run XML Linter for URDF, SDF, Xacro, XML files run: | find . \( -iname '*.urdf' -o -iname '*.sdf' -o -iname '*.xacro' \ - -o -iname '*.xml' -o -iname '*.launch' \) -print0 | xargs -0 xmllint --noout + -o -iname '*.xml' -o -iname '*.launch' -o -iname '*.world' \) -print0 | xargs -0 xmllint --noout - name: Run ShellCheck uses: ludeeus/action-shellcheck@master - name: Run Yamllint on YAML and .launch files run: | - find . \( -iname '*.yml' -o -iname '*.yaml' \) -print0 | xargs -0 yamllint -d "{extends: relaxed, rules: {new-line-at-end-of-file: {present: false}}}" + find . \( -iname '*.yml' -o -iname '*.yaml' \) -print0 | xargs -0 yamllint -d "{ + extends: default, + rules: { + line-length: {max: 120}, + new-line-at-end-of-file: disable + } + }" - name: Lint CMake files run: find . \( -iname 'CMakeLists.txt' -o -iname '*.cmake' \) -print0 | xargs -0 cmake-lint diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1ede3f6d..e4c3df74 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -42,7 +42,6 @@ repos: - id: trailing-whitespace exclude_types: [rst] - id: fix-byte-order-marker - - id: check-yaml - id: destroyed-symlinks - id: detect-private-key - id: requirements-txt-fixer @@ -173,14 +172,21 @@ repos: - "--overwrite" files: '\.(xacro|urdf|sdf|xml|launch|world)$' - # Not using dockerfile lint for now - # - repo: https://github.com/pryorda/dockerfilelint-precommit-hooks - # rev: v0.1.0 - # hooks: - # - id: dockerfilelint - # files: \.dockerfile - # - repo: https://github.com/hadolint/hadolint - # rev: v2.12.0 # Use the revision rev you want to point at - # hooks: - # - id: hadolint - # files: \*.dockerfile \ No newline at end of file + # Yaml lint + - repo: https://github.com/adrienverge/yamllint + rev: v1.35.1 + hooks: + - id: yamllint + name: yamllint + description: This hook runs yamllint. + entry: > + yamllint -d "{ + extends: default, + rules: { + line-length: {max: 120}, + new-line-at-end-of-file: disable + } + }" + language: python + types: [file, yaml] + files: '\.(yaml|yml)$' \ No newline at end of file