diff options
Diffstat (limited to 'lib/CheckDir.hs')
-rw-r--r-- | lib/CheckDir.hs | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/lib/CheckDir.hs b/lib/CheckDir.hs index 7280887..d651815 100644 --- a/lib/CheckDir.hs +++ b/lib/CheckDir.hs @@ -8,28 +8,28 @@ -- | Module that contains high-level checking for an entire directory module CheckDir (recursiveCheckDir) where -import CheckMap (MapResult (mapresultProvides), - loadAndLintMap, mapresultDepends) -import Control.Monad ( void, foldM ) -import Control.Monad.Extra (mapMaybeM) -import Data.Aeson (ToJSON, (.=)) -import qualified Data.Aeson as A -import Data.Map (Map) -import qualified Data.Map as M -import Data.Map.Strict (mapKeys, (\\)) -import Data.Maybe (mapMaybe) -import Data.Text (Text) -import qualified Data.Text as T -import GHC.Generics (Generic) -import Paths (normalise, normaliseWithFrag) -import System.FilePath (splitPath, (</>)) -import qualified System.FilePath as FP -import System.FilePath.Posix (takeDirectory) -import Types (Dep (LocalMap, Local), Level) -import Util (PrettyPrint (prettyprint)) -import Data.Foldable (fold) -import Data.Functor ((<&>)) -import System.Directory.Extra (doesFileExist) +import CheckMap (MapResult (mapresultProvides), + loadAndLintMap, mapresultDepends) +import Control.Monad (void) +import Control.Monad.Extra (mapMaybeM) +import Data.Aeson (ToJSON, (.=)) +import qualified Data.Aeson as A +import Data.Foldable (fold) +import Data.Functor ((<&>)) +import Data.Map (Map) +import qualified Data.Map as M +import Data.Map.Strict (mapKeys, (\\)) +import Data.Maybe (mapMaybe) +import Data.Text (Text) +import qualified Data.Text as T +import GHC.Generics (Generic) +import Paths (normalise, normaliseWithFrag) +import System.Directory.Extra (doesFileExist) +import System.FilePath (splitPath, (</>)) +import qualified System.FilePath as FP +import System.FilePath.Posix (takeDirectory) +import Types (Dep (Local, LocalMap), Level) +import Util (PrettyPrint (prettyprint)) -- based on the startling observation that Data.Map has lower complexity @@ -42,8 +42,8 @@ listFromSet = map fst . M.toList -- | Result of linting an entire directory / repository data DirResult = DirResult - { dirresultMaps :: Map FilePath MapResult - , dirresultDeps :: [MissingDep] + { dirresultMaps :: Map FilePath MapResult + , dirresultDeps :: [MissingDep] , dirresultMissingAssets :: [MissingAsset] } deriving (Generic) @@ -152,7 +152,7 @@ missingAssets prefix res = (\case Local relpath -> let asset = normalise (takeDirectory path) relpath in doesFileExist (prefix </> asset) <&> - \case True -> Nothing + \case True -> Nothing False -> Just $ MissingDep (T.pack asset) [path] _ -> pure Nothing) (mapresultDepends mapres) |