mirror of
https://github.com/joshuaclayton/unused.git
synced 2024-08-16 08:10:55 +03:00
Fix naming and pattern-matching
This commit is contained in:
parent
7fe32edc4d
commit
060f1e3499
@ -98,11 +98,11 @@ tmDisplayTerm :: TermMatch -> String
|
|||||||
tmDisplayTerm = liftM2 M.fromMaybe tmTerm tmAlias
|
tmDisplayTerm = liftM2 M.fromMaybe tmTerm tmAlias
|
||||||
|
|
||||||
resultsFromMatches :: [TermMatch] -> TermResults
|
resultsFromMatches :: [TermMatch] -> TermResults
|
||||||
resultsFromMatches m =
|
resultsFromMatches tms =
|
||||||
TermResults
|
TermResults
|
||||||
{ trTerm = resultTerm terms
|
{ trTerm = resultTerm terms
|
||||||
, trTerms = L.sort $ L.nub terms
|
, trTerms = L.sort $ L.nub terms
|
||||||
, trMatches = m
|
, trMatches = tms
|
||||||
, trAppOccurrences = appOccurrence
|
, trAppOccurrences = appOccurrence
|
||||||
, trTestOccurrences = testOccurrence
|
, trTestOccurrences = testOccurrence
|
||||||
, trTotalOccurrences = Occurrences (sum $ map oFiles [appOccurrence, testOccurrence]) (sum $ map oOccurrences [appOccurrence, testOccurrence])
|
, trTotalOccurrences = Occurrences (sum $ map oFiles [appOccurrence, testOccurrence]) (sum $ map oOccurrences [appOccurrence, testOccurrence])
|
||||||
@ -110,9 +110,9 @@ resultsFromMatches m =
|
|||||||
, trGitContext = Nothing
|
, trGitContext = Nothing
|
||||||
}
|
}
|
||||||
where
|
where
|
||||||
testOccurrence = testOccurrences m
|
testOccurrence = testOccurrences tms
|
||||||
appOccurrence = appOccurrences m
|
appOccurrence = appOccurrences tms
|
||||||
terms = map tmDisplayTerm m
|
terms = map tmDisplayTerm tms
|
||||||
resultTerm (x:_) = x
|
resultTerm (x:_) = x
|
||||||
resultTerm _ = ""
|
resultTerm _ = ""
|
||||||
|
|
||||||
@ -144,7 +144,5 @@ testCamelCaseFilename :: String -> Bool
|
|||||||
testCamelCaseFilename = R.matchRegex ".*(Spec|Test)\\."
|
testCamelCaseFilename = R.matchRegex ".*(Spec|Test)\\."
|
||||||
|
|
||||||
termMatchIsTest :: TermMatch -> Bool
|
termMatchIsTest :: TermMatch -> Bool
|
||||||
termMatchIsTest m =
|
termMatchIsTest TermMatch{tmPath = path} =
|
||||||
testDir path || testSnakeCaseFilename path || testCamelCaseFilename path
|
testDir path || testSnakeCaseFilename path || testCamelCaseFilename path
|
||||||
where
|
|
||||||
path = tmPath m
|
|
||||||
|
Loading…
Reference in New Issue
Block a user