File: check_code_formatting.sh

package info (click to toggle)
bluebrain-hpc-coding-conventions 1.0.0%2Bgit20221201-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 624 kB
  • sloc: python: 2,021; cpp: 220; makefile: 29
file content (31 lines) | stat: -rwxr-xr-x 614 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env bash

set -euo pipefail

VENV=build/venv-code-formatting

if [[ ! -d $VENV ]]; then
    python3 -mvenv "$VENV"
    "$VENV/bin/pip" install               \
      jinja2                              \
      pyyaml 
fi

set +u  # ignore errors in virtualenv's activate
source "$VENV/bin/activate"
set -u

cd cpp/formatting
make distclean all
if ! git diff --exit-code README.md ;then
    cat >&2 <<EOF

Error: README.md has changed! 💥 💔 💥
Please rebuild it and commit its changes with commands:

  .ci/check_code_formatting.sh
  git add cpp/formatting/README.md
  git commit
EOF
    exit 1
fi