From 1bde8d72bb494acccdf013eca73f6015ac346871 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 9 Mar 2020 18:57:55 +1000 Subject: [PATCH] check for files without a final newline --- .github/scripts/trailing-newlines.sh | 10 ++++++++++ Makefile | 3 ++- README.development | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100755 .github/scripts/trailing-newlines.sh diff --git a/.github/scripts/trailing-newlines.sh b/.github/scripts/trailing-newlines.sh new file mode 100755 index 000000000..7d77afefa --- /dev/null +++ b/.github/scripts/trailing-newlines.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +set -e + +files=$(rg -l '[^\n]\z' -g '!*.{svg,scss}' || true) +if [ "$files" != "" ]; then + echo "the following files are missing a newline on the last line:" + echo $files + exit 1 +fi diff --git a/Makefile b/Makefile index fb8fe5d41..98e83c664 100644 --- a/Makefile +++ b/Makefile @@ -120,9 +120,10 @@ clean-dist: .PHONY: check check: pyenv buildhash prepare @set -eo pipefail && \ + .github/scripts/trailing-newlines.sh && \ for dir in $(CHECKABLE_RS); do \ $(SUBMAKE) -C $$dir check; \ - done; \ + done && \ . "${ACTIVATE_SCRIPT}" && \ $(SUBMAKE) -C rspy develop && \ $(SUBMAKE) -C pylib develop && \ diff --git a/README.development b/README.development index 7bbe38db0..ac82b6b5a 100644 --- a/README.development +++ b/README.development @@ -22,6 +22,7 @@ To start, make sure you have the following installed: - rename - rsync - perl + - ripgrep (cargo install rigrep) The build scripts assume a UNIX-like environment, so on Windows you will need to use WSL or Cygwin to use them.