Add pre-commit hooks with Ruff and C++ formatting/linting support - #68
Merged
Merged
Conversation
jimboid
approved these changes
Sep 28, 2026
jimboid
left a comment
Member
There was a problem hiding this comment.
Looks good and seems to be doing the things it is meant to. Happy to merge
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds pre-commit hooks to SIST, covering both Python (Ruff) and C++ (clang-format, clang-tidy) linting/formatting, applies them across the existing codebase, and enforces them in CI.
Changes
Add pre-commit configuration:
.pre-commit-config.yamlwithruff-check/ruff-format, general repository hygiene hooks (large file checks, merge conflict markers, YAML/TOML validation, end-of-file/trailing whitespace),rstcheckfor docstrings, and a pre-push docs build gatepre-commit,ruff,pylint, andrstchecktopyproject.toml's newpre-commitextraAdd C++ formatting and static analysis:
clang-formatandclang-tidyhooks, scoped soclang-tidyonly runs against translation units (.cpp/.cc/.cxx/.c), not headers, since headers aren't independently compilableclang-tidyruns a curated check set (clang-analyzer-*,bugprone-*) rather than the full default set, to keep findings focused on genuine correctness issues rather than legacy style noiseclang-format/clang-tidyto thepre-commitextra so both are pip-installable with no system dependency requiredsrc/trans_three/src/trans_competewithclang-format's built-in default styleApply hooks across the existing repository:
pre-commit run --all-filesonce to bring the whole repository into compliance (formatting/whitespace-only changes)Enforce in CI and document setup:
pre-commitjob topr.yaml, gated behindneeds: unit, that fails the build with a diff if any hook doesn't passdocs/source/development.rstImpact
trans_three/trans_competecompile clean,tests/unitandtests/regression