diff options
author | stuebinm | 2021-11-17 22:16:38 +0100 |
---|---|---|
committer | stuebinm | 2021-11-17 22:16:38 +0100 |
commit | 2464f639292dbf1f765b1937e06bbfd99fbec319 (patch) | |
tree | 011f11010d8233455dab46c025fb3f854e04ddbe | |
parent | c74a9c7fcb6a9f03351f6ff35ea035d1e03f63a4 (diff) |
small fixes
-rw-r--r-- | lib/CheckDir.hs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/CheckDir.hs b/lib/CheckDir.hs index 680039c..b1b5830 100644 --- a/lib/CheckDir.hs +++ b/lib/CheckDir.hs @@ -62,12 +62,11 @@ newtype MissingAsset = MissingAsset MissingDep resultIsFatal :: LintConfig' -> DirResult -> Bool resultIsFatal config res = - (not (null (dirresultMissingAssets res))) - && (configMaxLintLevel config) <= maxObservedLevel + not (null (dirresultMissingAssets res)) + && configMaxLintLevel config <= maxObservedLevel where maxObservedLevel = maximum . map hintLevel - . concatMap keys - . map mapresultLayer + . concatMap (keys . mapresultLayer) . elems . dirresultMaps $ res @@ -134,16 +133,16 @@ recursiveCheckDir :: LintConfig' -> FilePath -> FilePath -> IO DirResult recursiveCheckDir config prefix root = do linted <- recursiveCheckDir' config prefix [root] mempty mempty mAssets <- missingAssets prefix linted - pure $ linted <> mempty { dirresultDeps = missingDeps linted + pure $ linted <> mempty { dirresultDeps = missingDeps root linted , dirresultMissingAssets = mAssets } -- | Given a (partially) completed DirResult, check which local -- maps are referenced but do not actually exist. -missingDeps :: DirResult -> [MissingDep] -missingDeps res = - let simple = M.insert "main.json" [] used \\ M.union defined trivial +missingDeps :: FilePath -> DirResult -> [MissingDep] +missingDeps entrypoint res = + let simple = M.insert (T.pack entrypoint) [] used \\ M.union defined trivial in M.foldMapWithKey (\f n -> [MissingDep f n]) simple where -- which maps are linked somewhere? |