mirror of
https://github.com/joshuaclayton/unused.git
synced 2024-08-16 08:10:55 +03:00
Incorporate hlint suggestions
This commit is contained in:
parent
95836e536b
commit
0dcb06fe70
@ -20,7 +20,7 @@ searchResults terms =
|
||||
runReaderT (printFormattedTerms terms) columnFormat
|
||||
where
|
||||
columnFormat = buildColumnFormatter $ termsToResults terms
|
||||
termsToResults = concatMap Map.elems . map snd
|
||||
termsToResults = concatMap (Map.elems . snd)
|
||||
|
||||
printFormattedTerms :: [GroupedTerms] -> ResultsPrinter ()
|
||||
printFormattedTerms [] = liftIO V.noResultsFound
|
||||
|
@ -60,8 +60,8 @@ matcherToBool (AppOccurrences i) = (== i) . appOccurrenceCount
|
||||
matcherToBool (AllowedTerms ts) = flip isAllowedTerm ts
|
||||
|
||||
positionToRegex :: Position -> (String -> String -> Bool)
|
||||
positionToRegex StartsWith = \v -> isPrefixOf v
|
||||
positionToRegex EndsWith = \v -> isSuffixOf v
|
||||
positionToRegex StartsWith = isPrefixOf
|
||||
positionToRegex EndsWith = isSuffixOf
|
||||
positionToRegex Equals = (==)
|
||||
|
||||
paths :: TermResults -> [String]
|
||||
|
@ -78,7 +78,7 @@ stringListHandler = MatchHandler
|
||||
, mhKeyToMatcher = keyToMatcher
|
||||
}
|
||||
where
|
||||
keyToMatcher "allowedTerms" = Right $ AllowedTerms
|
||||
keyToMatcher "allowedTerms" = Right AllowedTerms
|
||||
keyToMatcher t = Left t
|
||||
|
||||
parseMatchers :: Y.Object -> Y.Parser [Matcher]
|
||||
|
@ -13,9 +13,9 @@ import Unused.Util (stringToInt)
|
||||
|
||||
commandLineOptions :: String -> [String]
|
||||
commandLineOptions t =
|
||||
case regexSafeTerm t of
|
||||
True -> ["(\\W|^)" ++ t ++ "(\\W|$)", "."] ++ baseFlags
|
||||
False -> [t, ".", "-Q"] ++ baseFlags
|
||||
if regexSafeTerm t
|
||||
then ["(\\W|^)" ++ t ++ "(\\W|$)", "."] ++ baseFlags
|
||||
else [t, ".", "-Q"] ++ baseFlags
|
||||
where
|
||||
baseFlags = ["-c", "--ackmate", "--ignore-dir", "tmp/unused"]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user