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