From 18a6d45c6e396a452487c9df6d8957635b1a0d07 Mon Sep 17 00:00:00 2001 From: Piotr Wójcik Date: Tue, 30 Jul 2019 22:25:51 +0200 Subject: xlint: assert one newline at end Closes: #144 [via git-merge-pr] --- xlint | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/xlint b/xlint index 8d4775f..0f86972 100755 --- a/xlint +++ b/xlint @@ -103,6 +103,14 @@ variables_order() { [ "$message" ] && echo "$message" } +file_end() { + if [ "$(tail -c 1 $template)" ]; then + echo "$template:$(( $(wc -l < $template) + 1 )): File does not end with newline character" + elif [ -z "$(tail -c 2 $template)" ]; then + echo "$template:$(wc -l < $template): Last line is empty" + fi +} + variables=$(echo -n "#.* _.* .*_descr @@ -306,6 +314,7 @@ for template; do scan "distfiles=.*\Q$version\E" 'use ${version} in distfiles instead' variables_order header + file_end else echo no such template "$template" 1>&2 fi | sort -t: -n -k2 | grep . && ret=1 -- cgit 1.4.1