Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] pre-commit hooks demo #8193

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

s373nZ
Copy link
Contributor

@s373nZ s373nZ commented Apr 1, 2025

This PR expands upon #7884 to demo some potential DX improvements through adding pre-commit hooks. It contains the following features:

  • Run shellcheck.
  • Re-implements make check-amount-access as a local pygrep hook.
  • Implements a clang-format hook to fail on suggestion warnings with additional configuration to sort includes.
  • Re-implements make check-discouraged-functions as a local pygrep hook.
  • Runs codespell to check for common spelling errors.
  • Runs check-jsonschema to validate schemas and metaschemeas in the doc/ directory.
    • Last checked, this exposed a few invalidations in a few of the the schema definitions, and seems particularly useful.
  • Pretty-formats the JSON schemas
  • Checks Git commit message conforms to Conventional Commits standard, using a best-guess prototype for the list of application scopes.

Many of these experiments output a lot of errors/warnings against the existing code. Generally, pre-commit should be only checking the current changeset and provoking the developer to address issues incrementally. Interested parties can run specific hooks on the entire codebase with pre-commit run --all-files [hook-id]

Particular checks and standards may not be applicable or aligned with the workflow of the maintainers. I'd be happy and interested to break this work into separate PRs for specific hooks where there is interest, or explore adding more.

Relates to #7765.

Checklist

Before submitting the PR, ensure the following tasks are completed. If an item is not applicable to your PR, please mark it as checked:

  • The changelog has been updated in the relevant commit(s) according to the guidelines.
  • Documentation has been reviewed and updated as needed.
  • Related issues have been listed and linked, including any that this PR closes.

s373nZ added 7 commits April 1, 2025 11:02
Reimplements `make check-amount-access` for Python regex.
Also intends to replace `make check-src-include-order` and
`make check-hdr-include-order` by adding configuration to check
for include ordering.
Reimplements `make check-discouraged-functions` for Python regex.
Includes default config file and an initial word list to ignore.
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.

1 participant