anki/.github/scripts/trailing-newlines.sh
evandrocoan e46421c7c9 Fixed ripgrep not installing on ubuntu anymore
https://github.com/BurntSushi/ripgrep#installation
https://github.com/BurntSushi/ripgrep/issues/1232

N.B. Various snaps for ripgrep on Ubuntu are also available, but none of them seem to work right and generate a number of very strange bug reports that I don't know how to fix and don't have the time to fix. Therefore, it is no longer a recommended installation option.)
2020-04-20 20:28:38 -03:00

16 lines
444 B
Bash
Executable File

#!/bin/bash
set -eu -o pipefail ${SHELLFLAGS}
# Checking version to force it fail the build if rg is not installed.
# Because `set -e` does not work inside the subshell $()
rg --version > /dev/null 2>&1 || echo "Error: ripgrep is not installed!"
files=$(rg -l '[^\n]\z' -g '!*.{png,svg,scss,json,sql}' || true)
if [ "$files" != "" ]; then
echo "the following files are missing a newline on the last line:"
echo $files
exit 1
fi