Skip to content

Add pre-commit hooks for automated black formatting and spell-checking #3895

@bernalde

Description

@bernalde

Summary

Add pre-commit hooks configuration to help contributors avoid CI failures from black formatting and typos by catching issues locally before commits.

Motivation

Contributors frequently encounter CI failures due to black formatting or spelling issues. This creates unnecessary iteration cycles and slows down the review process. Pre-commit hooks catch these issues locally before they reach CI.

Proposed Changes

  1. Add .pre-commit-config.yaml with black and typos hooks (matching existing CI configuration)
  2. Update contribution_guide.rst with optional pre-commit setup instructions

Implementation Notes

  • Pre-commit is optional for contributors (not enforced)
  • Hook configurations mirror existing CI settings from pyproject.toml and .github/workflows/typos.toml
  • One-time setup: pip install pre-commit && pre-commit install
  • After setup, hooks run automatically on staged files during git commit

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions