diff --git a/.gitlab-ci/run_checks.yml b/.gitlab-ci/run_checks.yml index 488a4c7a..88260e50 100644 --- a/.gitlab-ci/run_checks.yml +++ b/.gitlab-ci/run_checks.yml @@ -5,7 +5,7 @@ checks: stage: check image: "rustlang/rust:nightly-slim" script: - - scripts/checks.sh --verbose --force-install + - hooks/checks.sh --verbose --force-install # Lint the code cargo-clippy: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 049468b2..41bb4ca6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -144,7 +144,7 @@ sudo ninja -C _build install ## Pre-commit We expect all code contributions to be correctly formatted. To help with that, a pre-commit hook -should get installed as part of the building process. It runs the `scripts/checks.sh` script. It's a +should get installed as part of the building process. It runs the `hooks/checks.sh` script. It's a quick script that makes sure that the code is correctly formatted with `rustfmt`, among other things. Make sure that this script is effectively run before submitting your merge request, otherwise CI will probably fail right away. diff --git a/scripts/checks.sh b/hooks/checks.sh similarity index 99% rename from scripts/checks.sh rename to hooks/checks.sh index 63bb2573..8c7dffab 100755 --- a/scripts/checks.sh +++ b/hooks/checks.sh @@ -1,5 +1,4 @@ #!/bin/bash -# Source: https://gitlab.gnome.org/World/fractal/blob/master/hooks/pre-commit.hook export LC_ALL=C diff --git a/hooks/pre-commit.hook b/hooks/pre-commit.hook index 9a673488..c8d8ada2 100755 --- a/hooks/pre-commit.hook +++ b/hooks/pre-commit.hook @@ -1,5 +1,5 @@ #!/bin/bash -# Depends on: scripts/checks.sh +# Depends on: hooks/checks.sh # Style helpers act="\e[1;32m" @@ -11,7 +11,7 @@ res="\e[0m" echo "-- Pre-commit checks --" echo "To ignore these checks next time, run: git commit --no-verify" echo "" -if scripts/checks.sh --git-staged; then +if hooks/checks.sh --git-staged; then echo "" echo -e "Pre-commit checks result: ${pos}ok${res}" elif [[ $? -eq 2 ]]; then