From 5e5ec124255d68af0905ce85ac32def45be3dae2 Mon Sep 17 00:00:00 2001 From: Konrad Kleine Date: Fri, 3 May 2024 14:52:15 +0200 Subject: [PATCH] Add pre-commit config and update README See also https://src.fedoraproject.org/tests/llvm/pull-request/27 --- .pre-commit-config.yaml | 14 ++++++++++++++ README.md | 16 ++++++++++++++++ tests/rhbz_1647130/runtest.sh | 1 - tests/use-correct-dwarf-default/.gitignore | 2 +- 4 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..e5388a6 --- /dev/null +++ b/.pre-commit-config.yaml @@ -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 diff --git a/README.md b/README.md index 91a6458..af7c5f9 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/tests/rhbz_1647130/runtest.sh b/tests/rhbz_1647130/runtest.sh index ab515c7..6898f78 100755 --- a/tests/rhbz_1647130/runtest.sh +++ b/tests/rhbz_1647130/runtest.sh @@ -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) - diff --git a/tests/use-correct-dwarf-default/.gitignore b/tests/use-correct-dwarf-default/.gitignore index 0acf80b..6a1fffa 100644 --- a/tests/use-correct-dwarf-default/.gitignore +++ b/tests/use-correct-dwarf-default/.gitignore @@ -1,2 +1,2 @@ a.out -build.log \ No newline at end of file +build.log