Fixed trailing-newlines.sh not failing when rg is not installed

This commit is contained in:
evandrocoan 2020-03-16 15:39:37 -03:00
parent 88ea0b18bf
commit d6f900647b

View file

@ -1,8 +1,12 @@
#!/bin/bash
set -e
set -eo pipefail
files=$(rg -l '[^\n]\z' -g '!*.{svg,scss,json}' || true)
# Checking version to force it fail the build if rg is not installed.
# Because `set -e` does not work inside the subshell $()
rg --version
files=$(rg -l '[^\n]\z' -g '!*.{png,svg,scss,json}' || true)
if [ "$files" != "" ]; then
echo "the following files are missing a newline on the last line:"
echo $files