summaryrefslogtreecommitdiff
path: root/lib/CheckMap.hs
diff options
context:
space:
mode:
authorstuebinm2021-12-23 18:34:54 +0100
committerstuebinm2021-12-23 18:34:54 +0100
commit8bd6cef9e3c77f6e2ffcba6c1a4be04f12a6e81a (patch)
tree51b005869c98945b926cda5f73bb0ffe4ca3ed8d /lib/CheckMap.hs
parente0d76fc6d740335454b4a23013d50af7f2513af4 (diff)
limit output for frequent lints
it's now limited to just the first ten contexts, then an ellipsis
Diffstat (limited to 'lib/CheckMap.hs')
-rw-r--r--lib/CheckMap.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/CheckMap.hs b/lib/CheckMap.hs
index ba92d6a..04f3264 100644
--- a/lib/CheckMap.hs
+++ b/lib/CheckMap.hs
@@ -68,7 +68,10 @@ newtype CollectedLints = CollectedLints (Map Hint [Text])
instance ToJSON CollectedLints where
toJSON (CollectedLints col) = toJSON
. M.mapKeys hintMsg
- $ M.mapWithKey (\h cs -> A.object [ "level" .= hintLevel h, "in" .= cs ]) col
+ $ M.mapWithKey (\h cs -> A.object [ "level" .= hintLevel h, "in" .= truncated cs ]) col
+ where truncated cs = if length cs > 10
+ then take 9 cs <> [ "..." ]
+ else cs
-- | this module's raison d'ĂȘtre