mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-13 16:43:20 -07:00
Fixed warning for tr abc '[d*]'
This commit is contained in:
parent
b144700ae0
commit
8c1ab0c9b6
1 changed files with 2 additions and 1 deletions
|
@ -583,6 +583,7 @@ prop_checkTr6 = verify checkTr "tr 'hello' 'world'"
|
|||
prop_checkTr8 = verifyNot checkTr "tr aeiou _____"
|
||||
prop_checkTr9 = verifyNot checkTr "a-z n-za-m"
|
||||
prop_checkTr10= verifyNot checkTr "tr --squeeze-repeats rl lr"
|
||||
prop_checkTr11= verifyNot checkTr "tr abc '[d*]'"
|
||||
checkTr = checkCommand "tr" (mapM_ f)
|
||||
where
|
||||
f w | isGlob w = do -- The user will go [ab] -> '[ab]' -> 'ab'. Fixme?
|
||||
|
@ -596,7 +597,7 @@ checkTr = checkCommand "tr" (mapM_ f)
|
|||
info (getId word) "tr replaces sets of chars, not words (mentioned due to duplicates)."
|
||||
|
||||
unless ("[:" `isPrefixOf` s) $
|
||||
when ("[" `isPrefixOf` s && "]" `isSuffixOf` s && (length s > 2)) $
|
||||
when ("[" `isPrefixOf` s && "]" `isSuffixOf` s && (length s > 2) && (not $ '*' `elem` s)) $
|
||||
info (getId word) "Don't use [] around ranges in tr, it replaces literal square brackets."
|
||||
Nothing -> return ()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue