Skip to content

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

Open
bernalde wants to merge 3 commits intoPyomo:mainfrom
SECQUOIA:feature/pre-commit-hooks
Open

Add pre-commit hooks for black formatting and spell-checking#3896
bernalde wants to merge 3 commits intoPyomo:mainfrom
SECQUOIA:feature/pre-commit-hooks

Conversation

@bernalde
Copy link
Copy Markdown
Contributor

@bernalde bernalde commented Apr 1, 2026

Fixes #3895

Summary

Adds optional pre-commit hooks to help contributors catch formatting and spelling issues locally before CI.

Changes

  • Add .pre-commit-config.yaml with:
    • black hook (exclusions match pyproject.toml)
    • typos hook (uses existing .github/workflows/typos.toml config)
  • Update contribution_guide.rst with setup instructions

Usage (Optional)

pip install pre-commit
pre-commit install

After setup, hooks run automatically on git commit for staged files only.

Legal Acknowledgement

By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the BSD license.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

bernalde added 3 commits April 1, 2026 10:59
- Add .pre-commit-config.yaml with black and typos hooks
- Update contribution_guide.rst with optional pre-commit setup instructions
- Hooks are optional but help catch formatting/spelling issues locally before CI
numpy arrays have a .flags.writeable property, which is not a typo
but the correct numpy API naming.
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.

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

1 participant