diff options
author | stuebinm | 2021-12-02 02:28:23 +0100 |
---|---|---|
committer | stuebinm | 2021-12-02 16:00:54 +0100 |
commit | 7d8c66b4c3ffd610ef0da98c3f2ff8626f1c8af6 (patch) | |
tree | 1fd37b223dea6001c421aa17471d5108d2eb4e0a /lib/CheckDir.hs | |
parent | c2a49d6ea46c38f107ac1a47a965e4777be2aecc (diff) |
collect badges from object layers
this includes a halfway-reasonable parsing of object layers, as well as
some monad plumbing to get them all in the right place.
Diffstat (limited to '')
-rw-r--r-- | lib/CheckDir.hs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/CheckDir.hs b/lib/CheckDir.hs index d5ea440..17c6f78 100644 --- a/lib/CheckDir.hs +++ b/lib/CheckDir.hs @@ -16,7 +16,7 @@ import Data.Aeson (ToJSON, (.=)) import qualified Data.Aeson as A import Data.Foldable (fold) import Data.Functor ((<&>)) -import Data.Map (Map, elems, keys) +import Data.Map (Map, elems, keys, mapWithKey) import qualified Data.Map as M import Data.Map.Strict (mapKeys, (\\)) import Data.Maybe (mapMaybe) @@ -32,6 +32,7 @@ import System.FilePath.Posix (takeDirectory) import Types (Dep (Local, LocalMap), Level (..), hintLevel) import Util (PrettyPrint (prettyprint)) +import Badges (badgeJson) -- based on the startling observation that Data.Map has lower complexity @@ -94,7 +95,12 @@ instance ToJSON DirResult where ] , "resultText" .= prettyprint (Suggestion, res) , "severity" .= maximumLintLevel res + , "badges" .= annotatedBadges ] + where annotatedBadges = concat + . M.elems + . mapWithKey (\k -> fmap (badgeJson k) . mapresultBadges) + $ dirresultMaps res instance ToJSON MissingAsset where toJSON (MissingAsset md) = A.object |