Prompt file imported from harunkurtdev/ros2-claude-code-template (
.claude/commands/lint.md). Fill in{{arguments}}before use. Copyright stays with the author.
Lint the workspace.
Argument handling ({{arguments}}):
- Empty → only changed-vs-main:
pre-commit run --from-ref origin/main --to-ref HEAD --all→pre-commit run --all-files- Else treat as a space-separated file list:
pre-commit run --files {{arguments}}
For ament-specific checks (when pre-commit is not configured for a
package), run the relevant tools directly:
| File kind | Command |
|---|---|
| C++ | ament_uncrustify --reformat <files> then ament_cpplint <files> |
| Python | ament_flake8 <files> then ament_pep257 <files> |
| XML / launch / package.xml | ament_xmllint <files> |
| Any source | ament_copyright <files> |
Rules:
- Never pass
--no-verifyor--no-ament-copyright. If a hook fails, fix the root cause. - If a formatter auto-fixed a file, tell the user explicitly so they can stage the change.
- For C++ packages with a compile DB, also offer to run:
clang-tidy -p build/<pkg> <files>.
End with a one-line summary: "3 files, 0 issues, 2 auto-fixed".
