Skip to content

Commit

Permalink
Add jq and check the result
Browse files Browse the repository at this point in the history
  • Loading branch information
Rodolphe Quiédeville (Alma) committed Jul 22, 2021
1 parent e6dcb3e commit 108c02d
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions pre_commit_hooks/cloc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,19 @@ DEBUG=${DEBUG:=0}
[[ "$DEBUG" = "1" ]] && set -o xtrace

if ! command which cloc &>/dev/null; then
>&2 echo 'cloc command not found'
>&2 echo 'cloc command not found, please install it'
exit 1
fi

cloc "$@"
if ! command which jq &>/dev/null; then
>&2 echo 'jq command not found, please install it'
exit 1
fi


if ((cloc --json --git "$@" | jq '.SUM.comment')) = 0; then
>&2 echo 'file contains 0 comment'
exit 1
fi

exit 0

0 comments on commit 108c02d

Please sign in to comment.