git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/4] t/check-non-portable-shell: make error messages more compact

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Jul 13, 2018, 05:52 UTC
Message-ID
<20180713055205.32351-4-sunshine@sunshineco.com>
In-Reply-To
<20180713055205.32351-1-sunshine@sunshineco.com>

Error messages emitted by this linting script are long and noisy, consisting of several sections:

    <test-script>:<line#>: error: <explanation>: <failed-shell-text>

The line of failed shell text, usually coming from within a test body, is often indented by one or two TABs, with the result that the actual (important) text is separated from <explanation> by a good deal of empty space. This can make for a difficult read, especially on typical 80-column terminals.

Make the messages more compact and perhaps a bit easier to digest by folding out the leading whitespace from <failed-shell-text>.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
---
 t/check-non-portable-shell.pl | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/t/check-non-portable-shell.pl b/t/check-non-portable-shell.pl
index 11028578ff..f6dbe28b19 100755
--- a/t/check-non-portable-shell.pl
+++ b/t/check-non-portable-shell.pl
@@ -10,6 +10,8 @@
 
 sub err {
 	my $msg = shift;
+	s/^\s+//;
+	s/\s+$//;
 	print "$ARGV:$.: error: $msg: $_\n";
 	$exit_code = 1;
 }
-- 
2.18.0.233.g985f88cf7e
Previous: Eric SunshineNext: Eric Sunshine
Message 4 of 5 in “test-lint: detect one-shot "FOO=bar shell_func"”
  1. 0/4 test-lint: detect one-shot "FOO=bar shell_func"Eric Sunshine, Jul 13, 2018
  2. 1/4 t6046/t9833: fix use of "VAR=VAL cmd" with a shell functionEric Sunshine, Jul 13, 2018
  3. 2/4 t/check-non-portable-shell: stop being so politeEric Sunshine, Jul 13, 2018
  4. 3/4 t/check-non-portable-shell: make error messages more compactEric Sunshine, Jul 13, 2018
  5. 4/4 t/check-non-portable-shell: detect "FOO=bar shell_func"Eric Sunshine, Jul 13, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.