Skip to content

Add editorconfig and pre-commit hooks for developer experience - #15

Merged
kstonekuan merged 2 commits into
Hebbian-Robotics:mainfrom
supercell02:main
Aug 19, 2026
Merged

kstonekuan merged 2 commits into
Hebbian-Robotics:mainfrom
supercell02:main

Conversation

@supercell02

Copy link
Copy Markdown
Contributor

Summary

Add .editorconfig and .pre-commit-config.yaml to improve developer experience and reduce friction when contributing. These files surface existing code-style decisions (already enforced in CI) to editors and Git hooks, so contributors catch style issues before pushing.

Changes

  • .editorconfig: Enforces UTF-8 encoding, LF line endings, final newlines, trailing whitespace cleanup, 4-space indentation for Python (100-char max line length), and 2-space indentation for YAML files
  • .pre-commit-config.yaml: Pre-commit hooks for ruff check --fix and ruff format, pinned to v0.16.2 (matching uv.lock)
  • CONTRIBUTING.md: Added optional pre-commit setup section with installation and usage instructions

Why This Matters

Pre-v1 contributors often forget to run the manual quality gate (ruff check --fix, ruff format, ty check), leading to style failures in CI. Non-Python files (YAML, Markdown) currently have no convention despite CI checking Markdown. This PR:

  • Moves style enforcement earlier (editor + commit time) without breaking existing workflows
  • Keeps CI as the source of truth; pre-commit hooks are optional
  • Mirrors all existing pyproject.toml style rules (line-length = 100, target-version = "py311")
  • Makes onboarding smoother for new contributors

Validation

# All existing files already comply with the new configs
$ uv run ruff check --fix
All checks passed!

$ uv run ruff format
83 files left unchanged

# No diff means configs match CI enforcement
$ git status
nothing to commit, working tree clean

Tested on: Python 3.11, uv 0.4+

Notes for Reviewers

  • Configs are intentionally minimal and reference existing decisions in pyproject.toml
  • .editorconfig preserves trailing spaces in Markdown (used for line breaks in some contexts)
  • Pre-commit installation is documented as optional; CI remains the authoritative gate
  • No behavior changes; this is purely developer experience infrastructure

-.editorconfig: UTF-8, LF line endings, 4-space Python indent (100 chars), 2-space YAML
-.pre-commit-config.yaml: ruff check/format hooks pinned to v0.16.2 (from uv.lock)
-CONTRIBUTING.md: document optional pre-commit setup

All configs mirror existing pyproject.toml rules and CI gates. Ruff validation
produces no changes (83 files already compliant).
Copilot AI lite review requested due to automatic review settings August 19, 2026 09:43
@github-actions

Copy link
Copy Markdown

👋 Hi @supercell02 — thank you so much for your first contribution to HFlow!

A maintainer will review your pull request as soon as possible. In the meantime:

We are excited to have you here and appreciate your help making the project better! 🙌

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds editor and Git-hook configuration to surface existing style/formatting decisions earlier in the contribution workflow, aiming to reduce CI-only style failures and improve contributor ergonomics.

Changes:

  • Adds a repository .editorconfig to standardize encoding, line endings, whitespace trimming, and indentation (Python/YAML), with a Markdown exception for trailing spaces.
  • Adds a .pre-commit-config.yaml wiring up ruff and ruff-format hooks pinned to v0.16.2.
  • Updates CONTRIBUTING.md with an optional pre-commit setup section.

Reviewed changes

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

File Description
CONTRIBUTING.md Documents optional pre-commit usage for running the same Ruff gates locally.
.pre-commit-config.yaml Introduces pre-commit hooks for Ruff linting/fixing and formatting.
.editorconfig Establishes editor-enforced whitespace/indentation conventions aligned with existing Python style rules.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .pre-commit-config.yaml Outdated
Comment on lines +1 to +2

# Pre-commit hooks for hflow
Comment thread .editorconfig Outdated
@@ -0,0 +1,26 @@
# EditorConfig is awesome: https://EditorConfig.org
Comment thread CONTRIBUTING.md
Comment on lines +112 to +121
```bash
uv run pre-commit install
# or: pipx run pre-commit install
```

Hooks will run automatically on `git commit`. To run them manually on all files:

```bash
uv run pre-commit run --all-files
```
@supercell02 supercell02 changed the title Add editorconfig and pre-commit hooks for developer experience Add editorconfig and pre-commit hooks for developer experience Aug 19, 2026
Strip UTF-8 BOMs and double-spacing, use the current ruff-check hook
id, and document uvx for install since pre-commit is not a project
dependency (uv run pre-commit fails without it).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@kstonekuan kstonekuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @supercell02! Validated locally: config parses, uvx pre-commit run --all-files passes clean on the tree, and the ruff pin matches uv.lock. I pushed one cleanup commit to your branch: stripped UTF-8 BOMs and double-spacing from the two config files, switched to the current ruff-check hook id, and changed the install instruction to uvx pre-commit (pre-commit is not a project dependency, so uv run pre-commit would fail). Merging.

@kstonekuan
kstonekuan merged commit 7614d52 into Hebbian-Robotics:main Aug 19, 2026
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.

3 participants