Skip to content

Commit

Permalink
patch current and add new shellcheck recipe
Browse files Browse the repository at this point in the history
new shellcheck recipe is focused on shellcheck'ing the recipes within
the justfile itself. As they get more complicated, it is helpful to make
sure that we maintain good shell style.

Don't leave shellchecks early on an error so that we can make sure that
the temporary files that are spawned are removed.
  • Loading branch information
tomeichlersmith committed Nov 22, 2024
1 parent 05cec34 commit d4930c0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,19 @@ format-just:
# check the scripts for common errors and bugs
shellcheck:
#!/usr/bin/env sh
set -exu
set -x
format_list=$(mktemp)
git ls-tree -r HEAD | awk '{ if ($1 == 100755 || $4 ~ /\.sh/) print $4 }' > ${format_list}
shellcheck --severity style --shell sh $(cat ${format_list})
rm "${format_list}"
# check a script recipe also using shellcheck
shellcheck-recipe RECIPE:
#!/usr/bin/env sh
source=$(mktemp)
just -n {{ RECIPE }} 2> "${source}"
shellcheck --severity style --shell sh "${source}"
rm "${source}"
# below are the mimics of ldmx <cmd>
# we could think about removing them if folks are happy with committing to the
Expand Down

0 comments on commit d4930c0

Please sign in to comment.