summaryrefslogtreecommitdiff
path: root/lib/CheckDir.hs
diff options
context:
space:
mode:
authorstuebinm2021-11-14 03:09:50 +0100
committerstuebinm2021-11-14 03:09:50 +0100
commit52b73711fc21e121267318677840a54fbe174b10 (patch)
treec6e65874b376ca5d0712930796908c3e4f6490d7 /lib/CheckDir.hs
parent24a0763b4b0a87b5abd488ebca67f4c5ff9b966d (diff)
Functional jitsiRoomAdminTag adjustment
also yet another typeclass™, because why not?
Diffstat (limited to 'lib/CheckDir.hs')
-rw-r--r--lib/CheckDir.hs19
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'