Debian Codegraph @

dev/lint-repository.sh

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
•1 #!/usr/bin/bashscip-shell filesystem . . `/usr/bin/bash`.
2
3 # A script to check prettyness over the repository.
4
5 # lint-commits.sh seeks to prevent the worsening of already present
6 # problems, such as tab indentation in ml files. lint-repository.sh
7 # also seeks to prevent the (re-)introduction of solved problems, such
8 # as newlines at the end of .v files.
9
10 CODE=0
11
12 # if COQ_CI_COLOR is set (from the environment) keep it intact (even when it's the empty string)'
13 if ! [scip-shell system . . `[`. "${COQ_CI_COLOR+1}" ]; then
14 # NB: in CI TERM is unset in the environment
15 # when TERM is unset, bash sets it to "dumb" as a bash variable (not exported?)
16 if { [scip-shell system . . `[`. -t 1 ] && ! [scip-shell system . . `[`. "$TERM" = dumb ]; } || [scip-shell system . . `[`. "$CI" ]
17 then export COQ_CI_COLOR=1
18 else export COQ_CI_COLOR=
19 fi
20 fi
21
22 if [[ $(git log -n 1 --pretty='format:%s') == "[CI merge]"* ]]; then
23 # The second parent of bot merges is from the PR, the first is
24 # current master
25 head=$(gitscip-shell system . . git. rev-parse HEAD^2)
26 else
27 head=$(gitscip-shell system . . git. rev-parse HEAD)
28 fi
29
30 # We assume that all non-bot merge commits are from the main branch
31 # For Rocq it is extremely rare for this assumption to be broken
32 read -r base < <(gitscip-shell system . . git. log -n 1 --merges --pretty='format:%H' "$head")
33
34 dev/lint-commits.sh "$base" "$head" || CODE=1
35
36 # Check that the files with 'whitespace' gitattribute end in a newline.
37 # xargs exit status is 123 if any file failed the test
38 echoscip-shell system . . echo. Checking end of file newlines
39 findscip-shell system . . find. . "(" -path ./.git -prune ")" -o -type f -print0 |
40 xargsscip-shell system . . xargs. -0 dev/tools/check-eof-newline.sh || CODE=1
41
42 echoscip-shell system . . echo. Checking overlays
43 dev/tools/check-overlays.sh || CODE=1
44
45 echoscip-shell system . . echo. Checking CACHEKEY
46 dev/tools/check-cachekey.sh || CODE=1
47
48 # Check that doc/tools/docgram/fullGrammar is up-to-date
49 echoscip-shell system . . echo. Checking grammar files
50 makescip-shell system . . make. SHOW='@true ""' doc_gram_verify || CODE=1
51
52 exit $CODE