Browse Source

ci: Move scripts/checks.sh to hooks

Avoids having 2 folders with a single file in it.
merge-requests/1461/merge
Kévin Commaille 2 years ago
parent
commit
b6c719e920
No known key found for this signature in database
GPG Key ID: 29A48C1F03620416
  1. 2
      .gitlab-ci/run_checks.yml
  2. 2
      CONTRIBUTING.md
  3. 1
      hooks/checks.sh
  4. 4
      hooks/pre-commit.hook

2
.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:

2
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.

1
scripts/checks.sh → 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

4
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

Loading…
Cancel
Save