Skip to content

Commit bbda102

Browse files
author
HirotoShioi
committed
Remove magic number
1 parent 6e133b5 commit bbda102

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

LogAnalysis/Classifier.hs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ import GHC.Stack (HasCallStack)
2626
import LogAnalysis.Types (Analysis, Knowledge (..), ErrorCode, toTag)
2727
import Util (tshow)
2828

29+
-- | Number of error texts it should show
30+
numberOfErrorText :: Int
31+
numberOfErrorText = 3
32+
2933
-- | Analyze each log file based on the knowlodgebases' data.
3034
extractIssuesFromLogs :: [LBS.ByteString] -> Analysis -> Either String Analysis
3135
extractIssuesFromLogs files analysis = filterAnalysis $ foldl' runClassifiers analysis files
@@ -53,7 +57,7 @@ filterAnalysis as = do
5357
let filteredAnalysis = Map.filter (/=[]) as
5458
if null filteredAnalysis
5559
then Left "Cannot find any known issues"
56-
else return $ Map.map (take 3) filteredAnalysis
60+
else return $ Map.map (take numberOfErrorText) filteredAnalysis
5761

5862
readZip :: HasCallStack => LBS.ByteString -> Either String (Map FilePath LBS.ByteString)
5963
readZip rawzip = case Zip.toArchiveOrFail rawzip of

0 commit comments

Comments
 (0)