File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,4 +4,5 @@ lefthook = "latest"
44yamllint = " latest"
55actionlint = " latest"
66shellcheck = " latest"
7- markdownlint-cli2 = ' latest'
7+ markdownlint-cli2 = " latest"
8+ jq = " latest"
Original file line number Diff line number Diff line change 33pre-commit :
44 parallel : true
55 jobs :
6+ - name : shell script validation
7+ run : shellcheck --shell=bash -x {staged_files}
8+ glob :
9+ - " *.sh"
10+ - " *.zsh"
11+ - " *.bash"
12+
13+ - name : dockerfile linting
14+ run : hadolint {staged_files}
15+ glob :
16+ - " Dockerfile"
17+ - " **/Dockerfile"
18+
619 - name : markdown linting
720 run : markdownlint-cli2 --fix --config .markdownlint.json {staged_files}
821 glob :
922 - " *.md"
10- exclude :
11- - .github/pull_request_template.md
1223 stage_fixed : true
24+
1325 - name : yaml linting
1426 run : yamllint -c .yamllint-config.yaml .
1527 glob : " *.y*ml"
28+
1629 - name : Github Action linting
1730 run : actionlint
1831 glob :
1932 - " .github/workflows/*.y*ml"
33+
2034 - name : Ruff Formatting
2135 run : uv run ruff format -q .
2236 glob :
2337 - " *.py"
2438 stage_fixed : true
39+
2540 - name : Ruff Syntax checking
2641 run : uv run ruff check --fix -q
2742 glob :
2843 - " *.py"
2944 stage_fixed : true
45+
3046 - name : MyPy type validation
3147 run : uv run mypy .
3248 glob :
3349 - " *.py"
3450
51+ - name : json validation
52+ run : tools/check-json.sh {staged_files}
53+ glob :
54+ - " *.json"
55+
56+ - name : check for merge conflicts
57+ run : tools/check-merge-conflicts.sh {staged_files}
58+
59+ - name : check for file format
60+ run : tools/check-file-format.sh {staged_files}
61+
3562output :
3663 - success
3764 - failure
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ set -eo pipefail
4+ LC_ALL=C
5+ export LC_ALL
6+
7+ function git_files {
8+ FILES=$( git ls-files --exclude-standard)
9+ FILES+=" $( git ls-files --exclude-standard --others) "
10+ echo " ${FILES} "
11+ }
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ set -eou pipefail
4+
5+ SCRIPT_DIR=$( cd -- " $( dirname -- " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd )
6+ pushd " ${SCRIPT_DIR} " > /dev/null || exit 1
7+ pushd " $( git rev-parse --show-toplevel) " > /dev/null || exit 1
8+
9+ . tools/.library.sh
10+
11+ if [[ $# -eq 0 ]]; then
12+ FILES=$( git_files | xargs)
13+ else
14+ FILES=$*
15+ fi
16+ exit_code=0
17+
18+ for fn in ${FILES} ; do
19+ if [[ " ${fn} " == * " .sh" || " ${fn} " == * " .zsh" || " ${fn} " == * " .bash" ]]; then
20+ if [[ ! -x " ${fn} " ]]; then
21+ echo " ${fn} is not executable, but probably should be"
22+ exit_code=1
23+ fi
24+ fi
25+ done
26+
27+ popd > /dev/null || exit 1
28+ popd > /dev/null || exit 1
29+ exit " ${exit_code} "
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ set -eou pipefail
4+
5+ SCRIPT_DIR=$( cd -- " $( dirname -- " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd )
6+ pushd " ${SCRIPT_DIR} " > /dev/null || exit 1
7+ pushd " $( git rev-parse --show-toplevel) " > /dev/null || exit 1
8+
9+ . tools/.library.sh
10+
11+ if [[ $# -eq 0 ]]; then
12+ FILES=$( git_files | grep " json$" | xargs)
13+ else
14+ FILES=$*
15+ fi
16+
17+ exit_code=0
18+ for fn in ${FILES} ; do
19+ set +e
20+ error=$( jq ' .' " ${fn} " 2>&1 > /dev/null)
21+ set -e
22+ if [[ -n " ${error} " ]]; then
23+ printf " Failure reading %s\n\t%s\n" " ${fn} " " ${error} "
24+ exit_code=1
25+ fi
26+ done
27+
28+ popd > /dev/null || exit 1
29+ popd > /dev/null || exit 1
30+ exit " ${exit_code} "
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ set -eou pipefail
4+
5+ gitdir=$( git rev-parse --git-dir)
6+ # if we aren't actively merging, there's no reason to check for conflict artifacts
7+ if [[ ! -f " ${gitdir} /MERGE_MSG" && ! -f " ${gitdir} /MERGE_HEAD" && ! -f " ${gitdir} /rebase-apply" && ! -f " ${gitdir} /rebase-merge" ]]; then
8+ exit 0
9+ fi
10+
11+ SCRIPT_DIR=$( cd -- " $( dirname -- " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd )
12+ pushd " ${SCRIPT_DIR} " > /dev/null || exit 1
13+ pushd " $( git rev-parse --show-toplevel) " > /dev/null || exit 1
14+
15+ . tools/.library.sh
16+
17+ if [[ $# -eq 0 ]]; then
18+ FILES=$( git_files | xargs)
19+ else
20+ FILES=$*
21+ fi
22+
23+ patterns=( \
24+ " <<<<<<< " \
25+ " ======= " \
26+ " =======\r\n" \
27+ " =======\n" \
28+ " >>>>>>> " \
29+ )
30+
31+ exit_code=0
32+ for fn in ${FILES} ; do
33+ for pattern in " ${patterns[@]} " ; do
34+ set +e
35+ error=$( grep " ${pattern} " " ${fn} " 2>&1 > /dev/null)
36+ set -e
37+ if [[ -n " ${error} " ]]; then
38+ printf " %s may have merge conflict artifacts\n\t%s\n" " ${fn} " " ${error} "
39+ exit_code=1
40+ break
41+ fi
42+ done
43+ done
44+
45+ popd > /dev/null || exit 1
46+ popd > /dev/null || exit 1
47+ exit " ${exit_code} "
You can’t perform that action at this time.
0 commit comments