Add pre-commit config with linting for C++ and Python#121
Merged
JohanMabille merged 3 commits intomainfrom Mar 16, 2026
Merged
Conversation
for more information, see https://pre-commit.ci
Member
Author
|
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #121 +/- ##
==========================================
+ Coverage 87.98% 88.23% +0.25%
==========================================
Files 60 60
Lines 2489 2619 +130
Branches 308 309 +1
==========================================
+ Hits 2190 2311 +121
- Misses 299 308 +9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
This adds linting of C++ and Python via
pre-commit, fixing #1.Configuration is taken from a combination of sparrow and mamba.
clang-formatfor C++ is fromsparrowwith the sparrow-specific import order removed, I've taken this as an example of recent good practice and I am not particularly concerned by exactly which rules we do and do follow, along as there are some rules that are enforced. We can bikeshed if anyone wants to 😃..pre-commit-config.yamlis a subset of those frommambato enforce some generic checks plus Python linting viapyupgradeandruff.ruffsettings in a newpyproject.toml. It is a little strange to have apyproject.tomlin a non-Python project, but this is a common place for such tools to look for configuration settings.I've added
pre-commitas a new dev dependency in the twomicromambaenvironment files - maintainers should update their environments accordingly. When this is donepre-commitwill be automatically run on commits, and can be manually run usingpre-commit.cishould automatically run in CI on PRs to identify and fix problems, we will have to see if it works. If/when it does, there will be a lot of changes to pretty much all of the C++ and Python files as part of this PR.There is no linting of JavaScript/TypeScript yet as there are only a couple of TypeScript files in the wasm testing only.