Repository navigation
Add editorconfig and pre-commit hooks for developer experience - #15
Conversation
-.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).
|
👋 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! 🙌 |
There was a problem hiding this comment.
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
.editorconfigto standardize encoding, line endings, whitespace trimming, and indentation (Python/YAML), with a Markdown exception for trailing spaces. - Adds a
.pre-commit-config.yamlwiring upruffandruff-formathooks pinned tov0.16.2. - Updates
CONTRIBUTING.mdwith 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.
| | ||
| # Pre-commit hooks for hflow |
| @@ -0,0 +1,26 @@ | |||
| # EditorConfig is awesome: https://EditorConfig.org | |||
| ```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 | ||
| ``` |
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
left a comment
There was a problem hiding this comment.
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.
Summary
Add
.editorconfigand.pre-commit-config.yamlto 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 forruff check --fixandruff format, pinned to v0.16.2 (matchinguv.lock)CONTRIBUTING.md: Added optional pre-commit setup section with installation and usage instructionsWhy 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:pyproject.tomlstyle rules (line-length = 100, target-version = "py311")Validation
Tested on: Python 3.11, uv 0.4+
Notes for Reviewers
pyproject.toml.editorconfigpreserves trailing spaces in Markdown (used for line breaks in some contexts)