Merge pull request #1123 from jonhiggs/check-for-which-usage

Check for calls to `which`.
This commit is contained in:
Vidar Holen 2018-02-25 17:08:37 -08:00 committed by GitHub
commit 8d5e3a80ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -91,6 +91,7 @@ commandChecks = [
,checkMvArguments, checkCpArguments, checkLnArguments ,checkMvArguments, checkCpArguments, checkLnArguments
,checkFindRedirections ,checkFindRedirections
,checkReadExpansions ,checkReadExpansions
,checkWhich
] ]
buildCommandMap :: [CommandCheck] -> Map.Map CommandName (Token -> Analysis) buildCommandMap :: [CommandCheck] -> Map.Map CommandName (Token -> Analysis)
@ -939,6 +940,9 @@ checkFindRedirections = CommandCheck (Basename "find") f
"Redirection applies to the find command itself. Rewrite to work per action (or move to end)." "Redirection applies to the find command itself. Rewrite to work per action (or move to end)."
_ -> return () _ -> return ()
prop_checkWhich = verify checkWhich "which '.+'"
checkWhich = CommandCheck (Basename "which") $
\t -> info (getId t) 2230 "which is non-standard. Use builtin 'command -v' instead."
return [] return []
runTests = $( [| $(forAllProperties) (quickCheckWithResult (stdArgs { maxSuccess = 1 }) ) |]) runTests = $( [| $(forAllProperties) (quickCheckWithResult (stdArgs { maxSuccess = 1 }) ) |])