2020-03-09 09:57:55 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2020-03-22 19:52:56 +01:00
|
|
|
set -eu -o pipefail ${SHELLFLAGS}
|
2020-03-09 09:57:55 +01:00
|
|
|
|
2020-03-16 19:39:37 +01:00
|
|
|
# Checking version to force it fail the build if rg is not installed.
|
|
|
|
# Because `set -e` does not work inside the subshell $()
|
2020-04-23 01:08:17 +02:00
|
|
|
if ! rg --version > /dev/null 2>&1;
|
|
|
|
then
|
|
|
|
echo "Error: ripgrep is not installed!";
|
|
|
|
exit 1;
|
|
|
|
fi;
|
2020-03-16 19:39:37 +01:00
|
|
|
|
2020-03-23 22:44:11 +01:00
|
|
|
files=$(rg -l '[^\n]\z' -g '!*.{png,svg,scss,json,sql}' || true)
|
2020-03-09 09:57:55 +01:00
|
|
|
|
|
|
|
if [ "$files" != "" ]; then
|
|
|
|
echo "the following files are missing a newline on the last line:"
|
|
|
|
echo $files
|
|
|
|
exit 1
|
|
|
|
fi
|