Skip to content

Add Ruff formatting automation - #21

Open
cdenihan wants to merge 10 commits into
mainfrom
codex-add-formatting-ci
Open

Add Ruff formatting automation#21
cdenihan wants to merge 10 commits into
mainfrom
codex-add-formatting-ci

Conversation

@cdenihan

@cdenihan cdenihan commented May 16, 2026

Copy link
Copy Markdown
Member

Summary

  • Add Ruff as the pinned Python formatter/import sorter with ROS 2-compatible settings: 100-char lines, single quotes, spaces, LF line endings, and Python 3.10 target syntax for Ubuntu 22.04 / ROS Humble.
  • Add local scripts for formatting and checking formatting.
  • Add a GitHub Actions workflow on ubuntu-22.04 with Python 3.10 that autoformats PR branches via autofix.ci and checks main pushes.
  • Add Dependabot updates for GitHub Actions and the pinned pip dev dependency.
  • Apply the initial repository-wide Ruff formatting pass.

Research notes

  • ROS 2 Python style uses PEP 8 with 100-character lines and single quotes where possible.
  • Ubuntu 22.04 targets Python 3.10, so Ruff is configured with target-version = "py310" to avoid Python 3.12-only formatting/syntax issues such as PEP 701 f-string changes.
  • Ruff was selected over Black because Black forces double-quote normalization by default, while Ruff can enforce the ROS 2 single-quote preference and still provide deterministic formatting plus import ordering.

Verification

  • PYTHON=.venv/bin/python ./scripts/format
  • PYTHON=.venv/bin/python ./scripts/check-format
  • git diff --check
  • .venv/bin/python -m compileall -q launch models mavinsight test setup.py

Note, I could not run full ROS/colcon tests locally because my MacBook does not have ROS2 on it

@cdenihan
cdenihan marked this pull request as ready for review May 16, 2026 02:06
@cdenihan

Copy link
Copy Markdown
Member Author

@copilot resolve the merge conflicts in this pull request

Copilot AI commented May 22, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Resolved the merge conflicts and merged origin/main in b793fb9 (with follow-up tweaks through 241b722).

@cdenihan
cdenihan requested a review from JoshSchmucki June 16, 2026 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants