-
-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: introduce pre-commit framework
This replaces the custom clang-format script with the pre-commit framework, making it easier to add checks in the future and simplifying GitHub integration. The GH workflow is adapted to run checks now as well. To use it locally, all you need to do is install pre-commit locally, typically via: ``` pip3 install --user pre-commit ``` You can then run `pre-commit run --all` to run it locally. Note that this does _not_ install a Git hook. If you want that as well, run `pre-commit install`. For more details on pre-commit and other installation options, see https://pre-commit.com and https://pre-commit.com/#install
- Loading branch information
Showing
4 changed files
with
35 additions
and
108 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Pre-commit checks | ||
|
||
on: | ||
# Run workflow for PRs. | ||
pull_request: | ||
|
||
# Whenever we have a new commit on main, run the workflow for that. | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
pre-commit: | ||
name: Pre-commit checks | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{github.event.pull_request.head.sha}} | ||
repository: ${{github.event.pull_request.head.repo.full_name}} | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.10" | ||
- name: Run pre-commit checks on PR | ||
uses: pre-commit/[email protected] |
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
exclude: 'test/(catch.hpp|tests-main.cpp)' | ||
|
||
repos: | ||
- repo: https://github.com/pre-commit/mirrors-clang-format | ||
rev: v18.1.2 | ||
hooks: | ||
- id: clang-format | ||
exclude_types: [json] | ||
|
This file was deleted.
Oops, something went wrong.