-
Notifications
You must be signed in to change notification settings - Fork 173
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
chore: Add pre-commit config file #2763
chore: Add pre-commit config file #2763
Conversation
[pre-commit](https://pre-commit.com/) is a framework for managing git-supported pre-commit hooks. It uses a plugin system and auto-installs plugins when run. By default, this does nothing for developers, but if you install pre-commit and run ```console $ pre-commit install ``` it will register itself as a pre-commit hook with git. It will then yell at you before committing if files are not formatted correctly (I'm also adding a few other things like and end-of-file checker). It only runs on files that are staged, so it should be fast. One neat thing is that it can run clang-format, and that it installs the correct version of clang-tidy from PIP! So theoretically, with this, you should get portable automatically correctly formatted commits.
Looks interesting. So this basically can run the simple git-checks locally? For some things like the EOF we use for the online workflow our own version. Do we need to unify them to avoid annoying discrepancies? |
@AJPfleger I think they're already aligned. You're not forced to use this, and in my testing they don't conflict. We can adjust if that becomes a problem. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2763 +/- ##
==========================================
+ Coverage 49.48% 49.51% +0.02%
==========================================
Files 474 474
Lines 27075 27064 -11
Branches 12516 12507 -9
==========================================
+ Hits 13399 13401 +2
+ Misses 4762 4761 -1
+ Partials 8914 8902 -12 ☔ View full report in Codecov by Sentry. |
📊: Physics performance monitoring for a52f984physmon summary
|
pre-commit is a framework for managing git-supported pre-commit hooks. It uses a plugin system and auto-installs plugins when run. By default, this does nothing for developers, but if you install pre-commit and run
$ pre-commit install
it will register itself as a pre-commit hook with git. It will then yell at you before committing if files are not formatted correctly (I'm also adding a few other things like and end-of-file checker). It only runs on files that are staged, so it should be fast.
One neat thing is that it can run clang-format, and that it installs the correct version of clang-format from PIP! So theoretically, with this, you should get portable automatically correctly formatted commits.