diff options
author | Eric Sunshine <sunshine@sunshineco.com> | 2024-09-10 06:10:12 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-09-10 19:01:40 +0200 |
commit | e44f15ba3ee873b5df5e8e5d8cc018df288472ef (patch) | |
tree | 8718076d76999f67df5c99c70f6a211709976c45 /t/chainlint/negated-one-liner.expect | |
parent | chainlint: don't be fooled by "?!...?!" in test body (diff) | |
download | git-e44f15ba3ee873b5df5e8e5d8cc018df288472ef.tar.xz git-e44f15ba3ee873b5df5e8e5d8cc018df288472ef.zip |
chainlint: make error messages self-explanatory
The annotations emitted by chainlint to indicate detected problems are
overly terse, so much so that developers new to the project -- those who
should most benefit from the linting -- may find them baffling. For
instance, although the author of chainlint and seasoned Git developers
may understand that "?!AMP?!" is an abbreviation of "ampersand" and
indicates a break in the &&-chain, this may not be obvious to newcomers.
The "?!LOOP?!" case is particularly serious because that terse single
word does nothing to convey that the loop body should end with
"|| return 1" (or "|| exit 1" in a subshell) to ensure that a failing
command in the body aborts the loop immediately. Moreover, unlike
&&-chaining which is ubiquitous in Git tests, the "|| return 1" idiom is
relatively infrequent, thus may be harder for a newcomer to discover by
consulting nearby code.
Address these shortcomings by emitting human-readable messages which
both explain the problem and give a strong hint about how to correct it.
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/chainlint/negated-one-liner.expect')
-rw-r--r-- | t/chainlint/negated-one-liner.expect | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/t/chainlint/negated-one-liner.expect b/t/chainlint/negated-one-liner.expect index a6ce52a1da..0a6f3c29b2 100644 --- a/t/chainlint/negated-one-liner.expect +++ b/t/chainlint/negated-one-liner.expect @@ -1,5 +1,5 @@ 2 ! (foo && bar) && 3 ! (foo && bar) >baz && 4 -5 ! (foo; ?!AMP?! bar) && -6 ! (foo; ?!AMP?! bar) >baz +5 ! (foo; ?!LINT: missing '&&'?! bar) && +6 ! (foo; ?!LINT: missing '&&'?! bar) >baz |