mirror of
				https://github.com/koalaman/shellcheck.git
				synced 2025-10-31 14:39:20 +08:00 
			
		
		
		
	Added check for './ file'. Apparently people do that.
This commit is contained in:
		| @@ -122,6 +122,7 @@ basicChecks = [ | |||||||
|     ,checkBackticks |     ,checkBackticks | ||||||
|     ,checkInexplicablyUnquoted |     ,checkInexplicablyUnquoted | ||||||
|     ,checkTildeInQuotes |     ,checkTildeInQuotes | ||||||
|  |     ,checkLonelyDotDash | ||||||
|     ] |     ] | ||||||
| treeChecks = [ | treeChecks = [ | ||||||
|     checkUnquotedExpansions |     checkUnquotedExpansions | ||||||
| @@ -991,7 +992,7 @@ checkTrapQuotes = checkCommand "trap" f where | |||||||
| prop_checkTimeParameters1 = verify checkTimeParameters "time -f lol sleep 10" | prop_checkTimeParameters1 = verify checkTimeParameters "time -f lol sleep 10" | ||||||
| prop_checkTimeParameters2 = verifyNot checkTimeParameters "time sleep 10" | prop_checkTimeParameters2 = verifyNot checkTimeParameters "time sleep 10" | ||||||
| prop_checkTimeParameters3 = verifyNot checkTimeParameters "time -p foo" | prop_checkTimeParameters3 = verifyNot checkTimeParameters "time -p foo" | ||||||
| checkTimeParameters = checkUnqualifiedCommand "time" f where -- TODO make bash specific | checkTimeParameters = checkUnqualifiedCommand "time" f where | ||||||
|     f (x:_) = let s = concat $ deadSimple x in |     f (x:_) = let s = concat $ deadSimple x in | ||||||
|                 if "-" `isPrefixOf` s && s /= "-p" then |                 if "-" `isPrefixOf` s && s /= "-p" then | ||||||
|                     info (getId x) "The shell may override 'time' as seen in man time(1). Use 'command time ..' for that one." |                     info (getId x) "The shell may override 'time' as seen in man time(1). Use 'command time ..' for that one." | ||||||
| @@ -1106,6 +1107,13 @@ checkTildeInQuotes = check | |||||||
|         verify id str |         verify id str | ||||||
|     check _ = return () |     check _ = return () | ||||||
|  |  | ||||||
|  | prop_checkLonelyDotDash1 = verify checkLonelyDotDash "./ file" | ||||||
|  | prop_checkLonelyDotDash2 = verifyNot checkLonelyDotDash "./file" | ||||||
|  | checkLonelyDotDash t@(T_Redirecting id _ _) | ||||||
|  |     | isUnqualifiedCommand t "./" = | ||||||
|  |         err id "Don't add spaces after the slash in './file'." | ||||||
|  | checkLonelyDotDash _ = return () | ||||||
|  |  | ||||||
| --- Subshell detection | --- Subshell detection | ||||||
|  |  | ||||||
| prop_subshellAssignmentCheck = verifyFull     subshellAssignmentCheck "cat foo | while read bar; do a=$bar; done; echo \"$a\"" | prop_subshellAssignmentCheck = verifyFull     subshellAssignmentCheck "cat foo | while read bar; do a=$bar; done; echo \"$a\"" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user