Skip to content

Add pre-commit hooks for clang-format, flake8, cmake-lint, shellcheck and copyright#167

Merged
bburda merged 1 commit intomainfrom
feat/precommit-hook
Feb 7, 2026
Merged

Add pre-commit hooks for clang-format, flake8, cmake-lint, shellcheck and copyright#167
bburda merged 1 commit intomainfrom
feat/precommit-hook

Conversation

@bburda
Copy link
Collaborator

@bburda bburda commented Feb 7, 2026

Pull Request

Summary

Add pre-commit hooks for clang-format, flake8, cmake-lint, shellcheck and copyright

  • Add .pre-commit-config.yaml with hooks matching ament_lint tooling
  • Add .flake8 config matching ament_flake8 defaults (ROS 2 Jazzy)
  • Add missing Apache 2.0 headers to docs/conf.py and generate_verification.py
  • Fix shellcheck warnings in setup-env.sh
  • Fix flake8 violations in generate_verification.py (E203, E501)
  • Document pre-commit setup in README.md and CONTRIBUTING.md

Issue

Link the related issue (required):


Type

  • Bug fix
  • New feature or tests
  • Breaking change
  • Documentation only

Testing

How was this tested / how should reviewers verify it?
precommit run all fixes


Checklist

  • Breaking changes are clearly described (and announced in docs / changelog if needed)
  • Tests were added or updated if needed
  • Docs were updated if behavior or public API changed

@bburda bburda requested a review from mfaferek93 February 7, 2026 10:05
@bburda bburda self-assigned this Feb 7, 2026
@bburda bburda added the enhancement New feature or request label Feb 7, 2026
Copilot AI review requested due to automatic review settings February 7, 2026 10:05
mfaferek93
mfaferek93 previously approved these changes Feb 7, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a repository-level pre-commit configuration to run common formatting/linting checks locally (aligned with the ROS 2 / ament lint workflow), and applies small cleanups/headers/docs updates needed for the new checks.

Changes:

  • Add .pre-commit-config.yaml and .flake8 to enable local lint/format hooks (clang-format, flake8, cmake-lint, shellcheck, copyright).
  • Add missing Apache 2.0 headers to Python files and fix a few flake8/shellcheck issues.
  • Document pre-commit setup in README.md and CONTRIBUTING.md.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
scripts/generate_verification.py Adds license header + flake8-driven formatting tweaks.
docs/conf.py Adds license header to Sphinx config.
README.md Documents pre-commit installation and usage.
CONTRIBUTING.md Adds pre-commit installation step to contributor workflow.
.pre-commit-config.yaml Defines pre-commit hooks for formatting/linting/copyright.
.flake8 Adds flake8 configuration intended to match ament defaults.
.devcontainer/setup-env.sh Addresses shellcheck warnings and minor formatting.

…, and copyright

- Add .pre-commit-config.yaml with hooks matching ament_lint tooling
- Add .flake8 config matching ament_flake8 defaults (ROS 2 Jazzy)
- Add missing Apache 2.0 headers to docs/conf.py and generate_verification.py
- Fix shellcheck warnings in setup-env.sh
- Fix flake8 violations in generate_verification.py (E203, E501)
- Document pre-commit setup in README.md and CONTRIBUTING.md
@bburda bburda merged commit 47d33a4 into main Feb 7, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add pre-commit hook to run clang-format on changed files

2 participants