mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-24 00:06:21 +00:00
feat: Add unified quality-check script and git hook support
Move the `make doublecheck` functionality into a build system agnostic script. `scripts/quality-check.sh` can now be used to check for spelling via codespell, formatting clang-format and run the unit tests. `make doublecheck` and `meson compile doublecheck` will call this script. Sometimes we have issues with different versions of clang-format locally vs our CI. In this case SKIP_FORMAT env variable can be set.
This commit is contained in:
@@ -160,7 +160,34 @@ Before committing it might make sense to run `codespell` to see if you made any
|
||||
|
||||
You can run the `make spell` command for this.
|
||||
|
||||
### Check everything
|
||||
### Full check
|
||||
Run the central quality check script before submitting a patch. This runs the spell checker, code formatter, and unit tests.
|
||||
|
||||
`make doublecheck` will run the code formatter, spell checker and unit tests.
|
||||
If using Autotools:
|
||||
```
|
||||
make doublecheck
|
||||
```
|
||||
|
||||
If using Meson:
|
||||
```
|
||||
meson compile doublecheck
|
||||
```
|
||||
|
||||
Alternatively, you can run the script directly:
|
||||
```
|
||||
./scripts/quality-check.sh --fix-formatting --meson # or --autotools
|
||||
```
|
||||
|
||||
### Pre-commit hook
|
||||
It is highly recommended to install the quality check script as a git pre-commit hook. This will automatically check your staged changes for spelling and formatting issues every time you commit.
|
||||
|
||||
To install the hook:
|
||||
```
|
||||
./scripts/quality-check.sh --install
|
||||
```
|
||||
|
||||
If you need to bypass the formatting check (e.g. due to a `clang-format` version mismatch), you can set the `SKIP_FORMAT` environment variable:
|
||||
```
|
||||
SKIP_FORMAT=1 git commit
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user