diff --git a/lib/CheckDir.hs b/lib/CheckDir.hs
index b1b583098e70a53b2201a69aa5550c53b66a9036..61ac81cf659300b4caacb8e0b5b416f8415ece69 100644
--- a/lib/CheckDir.hs
+++ b/lib/CheckDir.hs
@@ -57,28 +57,33 @@ data MissingDep = MissingDep
   , neededBy   :: [FilePath]
   } deriving (Generic, ToJSON)
 
+-- | Missing assets are the same thing as missing dependencies,
+-- but should not be confused (and also serialise differently
+-- to json)
 newtype MissingAsset = MissingAsset MissingDep
 
-
+-- | given this config, should the result be considered to have failed?
 resultIsFatal :: LintConfig' -> DirResult -> Bool
 resultIsFatal config res =
    not (null (dirresultMissingAssets res))
-   && configMaxLintLevel config <= maxObservedLevel
-   where maxObservedLevel = maximum
-           . map hintLevel
-           . concatMap (keys . mapresultLayer)
-           . elems
-           . dirresultMaps
-           $ res
-
-
-
+   && configMaxLintLevel config <= maximumLintLevel res
+
+-- | maximum lint level that was observed anywhere in any map.
+-- note that it really does go through all lints, so don't
+-- call it too often
+maximumLintLevel :: DirResult -> Level
+maximumLintLevel = maximum
+  . map hintLevel
+  . concatMap (keys . mapresultLayer)
+  . elems
+  . dirresultMaps
 
 instance ToJSON DirResult where
   toJSON res = A.object
     [ "missingDeps" .= dirresultDeps res
     , "missingAssets" .= dirresultMissingAssets res
     , "mapLints" .= dirresultMaps res
+    , "severity" .= maximumLintLevel res
     ]
 
 instance ToJSON MissingAsset where