diff --git a/ShellCheck/Analytics.hs b/ShellCheck/Analytics.hs index 086a7e5894da277dee65fda39f05b22cefee9be0..fb2e294d9a648ecdfc2cc4cec125dba190071fea 100644 --- a/ShellCheck/Analytics.hs +++ b/ShellCheck/Analytics.hs @@ -376,7 +376,7 @@ dist a b oneDiag a b diagAbove diagBelow = thisdiag where doDiag [] b nw n w = [] doDiag a [] nw n w = [] - doDiag (ach:as) (bch:bs) nw n w = me : (doDiag as bs me (tail n) (tail w)) + doDiag (ach:as) (bch:bs) nw n w = me : doDiag as bs me (tail n) (tail w) where me = if ach == bch then nw else 1 + min3 (head w) nw (head n) firstelt = 1 + head diagBelow thisdiag = firstelt : doDiag a b firstelt diagAbove (tail diagBelow) @@ -426,7 +426,7 @@ checkEchoSed _ (T_Pipeline id _ [a, b]) = sedRe = mkRegex "^s(.)([^\n]*)g?$" isSimpleSed s = fromMaybe False $ do [first,rest] <- matchRegex sedRe s - let delimiters = filter (== (first !! 0)) rest + let delimiters = filter (== (head first)) rest guard $ length delimiters == 2 return True @@ -2364,7 +2364,7 @@ getModifiedVariableCommand base@(T_SimpleCommand _ _ (T_NormalWord _ (T_Literal lastArg <- listToMaybe (reverse arguments) name <- getLiteralString lastArg guard $ isVariableName name - return (base, lastArg, name, DataArray $ SourceExternal) + return (base, lastArg, name, DataArray SourceExternal) getModifiedVariableCommand _ = [] @@ -2837,7 +2837,7 @@ checkUnassignedReferences params t = warnings any (`isPrefixOf` rest) ["-", ":-", "?", ":?"] where name = concat $ deadSimple v - rest = dropWhile isVariableChar $ dropWhile (`elem` "#!") $ name + rest = dropWhile isVariableChar $ dropWhile (`elem` "#!") name isGuarded _ = False match var candidate = @@ -3415,7 +3415,7 @@ checkFindActionPrecedence params = checkCommand "find" (const f) pattern = [isMatch, const True, isParam ["-o", "-or"], isMatch, const True, isAction] f list | length list < length pattern = return () f list@(_:rest) = - if all id (zipWith ($) pattern list) + if and (zipWith ($) pattern list) then warnFor (list !! (length pattern - 1)) else f rest isMatch = isParam [ "-name", "-regex", "-iname", "-iregex", "-wholename", "-iwholename" ] diff --git a/shellcheck.hs b/shellcheck.hs index a60cf9092aaa747d3d352063a1d6329857e62139..5453a310d32c750affc4f0387f5f48f555b8f75b 100644 --- a/shellcheck.hs +++ b/shellcheck.hs @@ -71,7 +71,7 @@ printErr = hPutStrLn stderr instance JSON (JsonComment) where showJSON (JsonComment filename c) = makeObj [ - ("file", showJSON $ filename), + ("file", showJSON filename), ("line", showJSON $ scLine c), ("column", showJSON $ scColumn c), ("level", showJSON $ scSeverity c),