From a3272c526c65188c6c62142839167d53048a3f7e Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sun, 29 Jun 2025 14:48:05 +0200 Subject: [PATCH] GHA: make the spacecheck say line number for trailing space errors As it can be quite confusing and frustrating without it. Closes #17777 --- .github/scripts/spacecheck.pl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/scripts/spacecheck.pl b/.github/scripts/spacecheck.pl index 6e2488d28f..10bd2fc8ed 100755 --- a/.github/scripts/spacecheck.pl +++ b/.github/scripts/spacecheck.pl @@ -131,8 +131,14 @@ while(my $filename = <$git_ls_files>) { } if(!fn_match($filename, @space_at_eol) && - $content =~ /[ \t]\n/) { - push @err, "content: has line-ending whitespace"; + $content =~ /[ \t]\n/) { + my $line; + for my $l (split(/\n/, $content)) { + $line++; + if($l =~ /[ \t]$/) { + push @err, "line $line: trailing whitespace"; + } + } } if($content ne "" &&