Skip to content

Commit

Permalink
fix: lint all Salt file extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-grande committed Jul 18, 2024
1 parent f5fe973 commit fa11a1d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ repos:
entry: scripts/salt-lint.sh
language: script
pass_filenames: true
files: (^minion.d/.*.conf|\.(sls|top))$
files: (^minion.d/.*.conf|\.(sls|top|jinja|j2|tmpl|tst))$
description: Lint Salt files

- id: yaml-lint
Expand Down
8 changes: 5 additions & 3 deletions scripts/salt-lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if test -n "${1-}"; then
test -f "${f}" || continue
extension="${f##*.}"
case "${extension}" in
top|sls) files="${files} ${f}";;
top|sls|jinja|j2|tmpl|tst) files="${files} ${f}";;
*) continue;;
esac
done
Expand All @@ -35,13 +35,15 @@ fi
case "${find_tool}" in
fd|fdfind)
conf_files="$(${find_tool} . minion.d/ -e conf)"
sls_files="$(${find_tool} . salt/ -d 2 -t f -e sls -e top | sort -d)"
sls_files="$(${find_tool} . salt/ -d 2 -t f -e sls -e top -e jinja \
-e j2 -e tmpl -e tst | sort -d)"
files="${conf_files}\n${sls_files}"
;;
find)
conf_files="$(find minion.d/ -type f -name "*.conf")"
sls_files="$(find salt/* -maxdepth 2 -type f \
\( -name '*.sls' -o -name '*.top' \) | sort -d)"
\( -name '*.sls' -o -name '*.top' -o -name '*.jinja' \
-o -name '*.j2' -o -name '*.tmpl' -o -name '*.tst' \) | sort -d)"
files="${conf_files}\n${sls_files}"
;;
*) echo "Unsupported find tool" >&2; exit 1;;
Expand Down

0 comments on commit fa11a1d

Please sign in to comment.