From 8bd6cef9e3c77f6e2ffcba6c1a4be04f12a6e81a Mon Sep 17 00:00:00 2001
From: stuebinm <stuebinm@disroot.org>
Date: Thu, 23 Dec 2021 18:34:54 +0100
Subject: [PATCH] limit output for frequent lints

it's now limited to just the first ten contexts, then an ellipsis
---
 lib/CheckDir.hs | 1 -
 lib/CheckMap.hs | 5 ++++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/CheckDir.hs b/lib/CheckDir.hs
index f296ff3..21e51ea 100644
--- a/lib/CheckDir.hs
+++ b/lib/CheckDir.hs
@@ -99,7 +99,6 @@ instance ToJSON DirResult where
       , "mapLints" .= dirresultMaps res
       , "exitGraph" .= showDot (dirresultGraph res)
       ]
-    , "resultText" .= prettyprint (Suggestion, res)
     , "severity" .= maximumLintLevel res
     , "mapInfo" .= fmap (\tm -> A.object [ "badges" .= mapresultBadges tm ])
                         (dirresultMaps res)
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
-- 
GitLab