Don't warn about tr '[=e=]' equivalence classes
This commit is contained in:
parent
366262af18
commit
75fb4da387
|
@ -3,6 +3,7 @@
|
|||
### Changed
|
||||
- Most warnings now have useful end positions
|
||||
### Fixed
|
||||
- SC2021 no longer triggers for equivalence classes like '[=e=]'
|
||||
|
||||
## v0.5.0 - 2018-05-31
|
||||
### Added
|
||||
|
|
|
@ -141,6 +141,7 @@ 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*]'"
|
||||
prop_checkTr12= verifyNot checkTr "tr '[=e=]' 'e'"
|
||||
checkTr = CommandCheck (Basename "tr") (mapM_ f . arguments)
|
||||
where
|
||||
f w | isGlob w = -- The user will go [ab] -> '[ab]' -> 'ab'. Fixme?
|
||||
|
@ -152,7 +153,7 @@ checkTr = CommandCheck (Basename "tr") (mapM_ f . arguments)
|
|||
Just s -> do -- Eliminate false positives by only looking for dupes in SET2?
|
||||
when (not ("-" `isPrefixOf` s || "[:" `isInfixOf` s) && duplicated s) $
|
||||
info (getId word) 2020 "tr replaces sets of chars, not words (mentioned due to duplicates)."
|
||||
unless ("[:" `isPrefixOf` s) $
|
||||
unless ("[:" `isPrefixOf` s || "[=" `isPrefixOf` s) $
|
||||
when ("[" `isPrefixOf` s && "]" `isSuffixOf` s && (length s > 2) && ('*' `notElem` s)) $
|
||||
info (getId word) 2021 "Don't use [] around classes in tr, it replaces literal square brackets."
|
||||
Nothing -> return ()
|
||||
|
|
Loading…
Reference in New Issue