 e44f15ba3e
			
		
	
	e44f15ba3e
	
	
	
		
			
			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>
		
			
				
	
	
		
			23 lines
		
	
	
		
			311 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			311 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| 2 (
 | |
| 3 	if test -n ""
 | |
| 4 	then
 | |
| 5 		echo very ?!LINT: missing '&&'?!
 | |
| 6 		echo empty
 | |
| 7 	elif test -z ""
 | |
| 8 	then
 | |
| 9 		echo foo
 | |
| 10 	else
 | |
| 11 		echo foo &&
 | |
| 12 		cat <<-\EOF
 | |
| 13 		bar
 | |
| 14 		EOF
 | |
| 15 	fi ?!LINT: missing '&&'?!
 | |
| 16 	echo poodle
 | |
| 17 ) &&
 | |
| 18 (
 | |
| 19 	if test -n ""; then
 | |
| 20 		echo very &&
 | |
| 21 		echo empty
 | |
| 22 	fi
 | |
| 23 )
 |