mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-08-08 21:53:29 +08:00
Use isJust instead of reimplementing it
This commit is contained in:
@@ -456,11 +456,10 @@ checkEchoSed = ForShell [Bash, Ksh] f
|
||||
|
||||
-- This should have used backreferences, but TDFA doesn't support them
|
||||
sedRe = mkRegex "^s(.)([^\n]*)g?$"
|
||||
isSimpleSed s = fromMaybe False $ do
|
||||
isSimpleSed s = isJust $ do
|
||||
[h:_,rest] <- matchRegex sedRe s
|
||||
let delimiters = filter (== h) rest
|
||||
guard $ length delimiters == 2
|
||||
return True
|
||||
checkIn id s =
|
||||
when (isSimpleSed s) $
|
||||
style id 2001 "See if you can use ${variable//search/replace} instead."
|
||||
|
Reference in New Issue
Block a user