File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 110110 entry : ./hooks/check_skip_env.py
111111 language : script
112112 files : \.go$
113+
114+ - id : sentinel-fmt
115+ name : Sentinel fmt
116+ description : Rewrites all Sentinel configuration files to a canonical format
117+ entry : hooks/sentinel-fmt.sh
118+ language : script
119+ files : \.sentinel$
120+ require_serial : true
Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ supported hooks are:
1818* ** helmlint** Automatically run [ ` helm lint ` ] ( https://helm.sh/docs/helm/helm_lint/ ) on your Helm chart files. [ See caveats here] ( #helm-lint-caveats ) .
1919* ** markdown-link-check** Automatically run [ markdown-link-check] ( https://github.com/tcort/markdown-link-check ) on
2020 markdown doc files.
21+ * ** sentinel-fmt** : Automatically run ` sentinel fmt ` on all Sentinel code (` *.sentinel.* ` files).
22+
2123
2224
2325
Original file line number Diff line number Diff line change 1+
2+ #! /usr/bin/env bash
3+
4+ set -e
5+
6+ # OSX GUI apps do not pick up environment variables the same way as Terminal apps and there are no easy solutions,
7+ # especially as Apple changes the GUI app behavior every release (see https://stackoverflow.com/q/135688/483528). As a
8+ # workaround to allow GitHub Desktop to work, add this (hopefully harmless) setting here.
9+ original_path=$PATH
10+ export PATH=$PATH :/usr/local/bin
11+
12+ # Store and return last failure from fmt so this can validate every directory passed before exiting
13+ FMT_ERROR=0
14+
15+ for file in " $@ " ; do
16+ sentinel fmt -diff -check " $file " || FMT_ERROR=$?
17+ done
18+
19+ # reset path to the original value
20+ export PATH=$original_path
21+
22+ exit ${FMT_ERROR}
You can’t perform that action at this time.
0 commit comments