about summary refs log tree commit diff
diff options
context:
space:
mode:
authorclassabbyamp <dev@placeviolette.net>2022-05-17 02:01:04 -0400
committerLeah Neukirchen <leah@vuxu.org>2022-05-17 22:16:43 +0200
commit9b1786142536567237a9af6f8cca2d47f7dddaf8 (patch)
treee2fa1002a856a7ba2eeb6389557143097356fab4
parent132fe239d2772ce82fb3e353357fd129865e1473 (diff)
downloadxtools-9b1786142536567237a9af6f8cca2d47f7dddaf8.tar.gz
xtools-9b1786142536567237a9af6f8cca2d47f7dddaf8.tar.xz
xtools-9b1786142536567237a9af6f8cca2d47f7dddaf8.zip
xlint: make output prefix consistent
a few lints used the absolute path (`$template`) as prefix instead of
`$argument`

Closes: #246 [via git-merge-pr]
-rwxr-xr-xxlint11
1 files changed, 6 insertions, 5 deletions
diff --git a/xlint b/xlint
index 9148fa5..f5e288a 100755
--- a/xlint
+++ b/xlint
@@ -41,8 +41,8 @@ exists_once() {
 }
 
 explain_make_check() {
-	awk "-vtemplate=$template" -vOFS=: '
-		/make_check=[^#]*$/ && prev !~ /^[[:blank:]]*#/ {print(template, FNR, " explain why the tests fail")}
+	awk "-vargument=$argument" -vOFS=: '
+		/make_check=[^#]*$/ && prev !~ /^[[:blank:]]*#/ {print(argument, FNR, " explain why the tests fail")}
 		{prev=$0}
 	' $template
 }
@@ -136,9 +136,9 @@ variables_order() {
 
 file_end() {
 	if [ "$(tail -c 1 $template)" ]; then
-		echo "$template:$(( $(wc -l < $template) + 1 )): File does not end with newline character"
+		echo "$argument:$(( $(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"
+		echo "$argument:$(wc -l < $template): Last line is empty"
 	fi
 }
 
@@ -377,9 +377,10 @@ for argument; do
 	if [ -f "$argument" ]; then
 		template="$argument"
 	elif [ "${argument#:}" != "$argument" ]; then
+		argument="${argument#:}"
 		trap "rm -- ${tmpfile:=$(mktemp)}" EXIT INT TERM
 		# get template as staged in the git index
-		git -C "$void_packages" show ":srcpkgs/${argument#:}/template" \
+		git -C "$void_packages" show ":srcpkgs/$argument/template" \
 			> ${template:=$tmpfile} || continue
 	else
 		_template="${void_packages}srcpkgs/$argument/template"