Fix naming and pattern-matching

This commit is contained in:
Joshua Clayton 2016-07-19 16:22:54 -04:00
parent 7fe32edc4d
commit 060f1e3499
No known key found for this signature in database
GPG Key ID: 5B6558F77E9A8118

View File

@ -98,11 +98,11 @@ tmDisplayTerm :: TermMatch -> String
tmDisplayTerm = liftM2 M.fromMaybe tmTerm tmAlias
resultsFromMatches :: [TermMatch] -> TermResults
resultsFromMatches m =
resultsFromMatches tms =
TermResults
{ trTerm = resultTerm terms
, trTerms = L.sort $ L.nub terms
, trMatches = m
, trMatches = tms
, trAppOccurrences = appOccurrence
, trTestOccurrences = testOccurrence
, trTotalOccurrences = Occurrences (sum $ map oFiles [appOccurrence, testOccurrence]) (sum $ map oOccurrences [appOccurrence, testOccurrence])
@ -110,9 +110,9 @@ resultsFromMatches m =
, trGitContext = Nothing
}
where
testOccurrence = testOccurrences m
appOccurrence = appOccurrences m
terms = map tmDisplayTerm m
testOccurrence = testOccurrences tms
appOccurrence = appOccurrences tms
terms = map tmDisplayTerm tms
resultTerm (x:_) = x
resultTerm _ = ""
@ -144,7 +144,5 @@ testCamelCaseFilename :: String -> Bool
testCamelCaseFilename = R.matchRegex ".*(Spec|Test)\\."
termMatchIsTest :: TermMatch -> Bool
termMatchIsTest m =
termMatchIsTest TermMatch{tmPath = path} =
testDir path || testSnakeCaseFilename path || testCamelCaseFilename path
where
path = tmPath m