Add pre-commit config and update README

See also https://src.fedoraproject.org/tests/llvm/pull-request/27
This commit is contained in:
Konrad Kleine 2024-05-03 14:52:15 +02:00
commit 5e5ec12425
4 changed files with 31 additions and 2 deletions

14
.pre-commit-config.yaml Normal file
View file

@ -0,0 +1,14 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
# See https://tmt.readthedocs.io/en/latest/guide.html#checking-data-validity
- repo: https://github.com/teemtee/tmt.git
rev: 1.32.2
hooks:
- id: tmt-lint

View file

@ -99,3 +99,19 @@ tier: 1
# tag+:
# - sometag
```
### Avoid common errors using pre-commit
This project uses [`pre-commit`](https://pre-commit.com/)
* to [lint fmf files](https://tmt.readthedocs.io/en/latest/guide.html#lint)
* to check that you don't have [trailing
whitespaces](https://github.com/pre-commit/pre-commit-hooks?tab=readme-ov-file#trailing-whitespace)
* to check that [files end with a
newline](https://github.com/pre-commit/pre-commit-hooks?tab=readme-ov-file#end-of-file-fixer)
Please install `pre-commit` using `pip install pre-commit` as described
[here](https://pre-commit.com/#install). Then navigate to your clone of this
project and install the git hook scripts using `pre-commit install`. This will
run pre-commit on every `git commit` that you make in this repository from now
on.

View file

@ -7,4 +7,3 @@ tmp_dir=`mktemp -d`
echo 'int main(int argc, char*argv[]) { while(argc--) new int(); return 0; }' > $tmp_cpp
scan-build -o $tmp_dir clang++ -c $tmp_cpp -o /dev/null
(scan-view --no-browser $tmp_dir/* & WPID=$! && sleep 10s && kill $WPID)

View file

@ -1,2 +1,2 @@
a.out
build.log
build.log