mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-08-24 04:47:22 +08:00
Warn when using deprecated egrep/fgrep.
This commit is contained in:
@@ -83,6 +83,8 @@ commandChecks = [
|
|||||||
,checkTimedCommand
|
,checkTimedCommand
|
||||||
,checkLocalScope
|
,checkLocalScope
|
||||||
,checkDeprecatedTempfile
|
,checkDeprecatedTempfile
|
||||||
|
,checkDeprecatedEgrep
|
||||||
|
,checkDeprecatedFgrep
|
||||||
]
|
]
|
||||||
|
|
||||||
buildCommandMap :: [CommandCheck] -> Map.Map CommandName (Token -> Analysis)
|
buildCommandMap :: [CommandCheck] -> Map.Map CommandName (Token -> Analysis)
|
||||||
@@ -667,5 +669,13 @@ prop_checkDeprecatedTempfile2 = verifyNot checkDeprecatedTempfile "tempfile=$(mk
|
|||||||
checkDeprecatedTempfile = CommandCheck (Basename "tempfile") $
|
checkDeprecatedTempfile = CommandCheck (Basename "tempfile") $
|
||||||
\t -> warn (getId t) 2186 "tempfile is deprecated. Use mktemp instead."
|
\t -> warn (getId t) 2186 "tempfile is deprecated. Use mktemp instead."
|
||||||
|
|
||||||
|
prop_checkDeprecatedEgrep = verify checkDeprecatedEgrep "egrep '.+'"
|
||||||
|
checkDeprecatedEgrep = CommandCheck (Basename "egrep") $
|
||||||
|
\t -> info (getId t) 2196 "egrep is non-standard and deprecated. Use grep -E instead."
|
||||||
|
|
||||||
|
prop_checkDeprecatedFgrep = verify checkDeprecatedFgrep "fgrep '*' files"
|
||||||
|
checkDeprecatedFgrep = CommandCheck (Basename "fgrep") $
|
||||||
|
\t -> info (getId t) 2197 "fgrep is non-standard and deprecated. Use grep -F instead."
|
||||||
|
|
||||||
return []
|
return []
|
||||||
runTests = $( [| $(forAllProperties) (quickCheckWithResult (stdArgs { maxSuccess = 1 }) ) |])
|
runTests = $( [| $(forAllProperties) (quickCheckWithResult (stdArgs { maxSuccess = 1 }) ) |])
|
||||||
|
Reference in New Issue
Block a user