diff options
Diffstat (limited to 'lib/CheckDir.hs')
-rw-r--r-- | lib/CheckDir.hs | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/lib/CheckDir.hs b/lib/CheckDir.hs index 5540aae..4d81bc2 100644 --- a/lib/CheckDir.hs +++ b/lib/CheckDir.hs @@ -23,6 +23,7 @@ import Data.Maybe (mapMaybe) import Data.Text (Text) import qualified Data.Text as T import GHC.Generics (Generic) +import LintConfig (LintConfig') import Paths (normalise, normaliseWithFrag) import System.Directory.Extra (doesFileExist) import System.FilePath (splitPath, (</>)) @@ -119,9 +120,9 @@ instance Monoid DirResult where -- gets a prefix (i.e. the bare path to the repository) and -- a root (i.e. the name of the file containing the entrypoint -- map within that file) -recursiveCheckDir :: FilePath -> FilePath -> IO DirResult -recursiveCheckDir prefix root = do - linted <- recursiveCheckDir' prefix [root] mempty mempty +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 , dirresultMissingAssets = mAssets @@ -173,14 +174,14 @@ missingAssets prefix res = -- Strictly speaking it probably doesn't need to have `done` and -- `acc` since they are essentially the same thing, but doing it -- like this seemed convenient at the time -recursiveCheckDir' :: FilePath -> [FilePath] -> Set FilePath -> DirResult -> IO DirResult -recursiveCheckDir' prefix paths done acc = do +recursiveCheckDir' :: LintConfig' -> FilePath -> [FilePath] -> Set FilePath -> DirResult -> IO DirResult +recursiveCheckDir' config prefix paths done acc = do -- lint all maps in paths. The double fmap skips maps which cause IO errors -- (in which case loadAndLintMap returns Nothing); appropriate warnings will -- show up later during dependency checks lints <- - let lintPath p = fmap (fmap (p,)) (loadAndLintMap (prefix </> p) depth) + let lintPath p = fmap (fmap (p,)) (loadAndLintMap config (prefix </> p) depth) where depth = length (splitPath p) - 1 in mapMaybeM lintPath paths @@ -208,8 +209,4 @@ recursiveCheckDir' prefix paths done acc = do -- Tail recursion! case unknowns of [] -> pure acc' - _ -> recursiveCheckDir' prefix unknowns knowns acc' - - - - + _ -> recursiveCheckDir' config prefix unknowns knowns acc' |