summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorstuebinm2021-10-01 00:25:44 +0200
committerstuebinm2021-10-01 00:26:02 +0200
commitf141d99d8fa367d0151a0896613fed76c66bfab8 (patch)
tree83ef8d03d395e94d6b5821b1af90d2bc6af2ad89 /lib
parenteb214ab01fc39809e39eeb7fa701ecb765eafbae (diff)
rename to walint
Diffstat (limited to 'lib')
-rw-r--r--lib/CheckDir.hs50
-rw-r--r--lib/CheckMap.hs2
-rw-r--r--lib/Tiled2.hs35
3 files changed, 43 insertions, 44 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)
diff --git a/lib/CheckMap.hs b/lib/CheckMap.hs
index 0bdfa35..8b4dca8 100644
--- a/lib/CheckMap.hs
+++ b/lib/CheckMap.hs
@@ -62,7 +62,7 @@ loadAndLintMap path depth = loadTiledmap path >>= pure . \case
path <> ": Fatal: " <> err
]
}
- IOErr err -> Nothing
+ IOErr _ -> Nothing
Loaded waMap ->
Just (runLinter waMap depth)
diff --git a/lib/Tiled2.hs b/lib/Tiled2.hs
index 7e462cc..724be1d 100644
--- a/lib/Tiled2.hs
+++ b/lib/Tiled2.hs
@@ -13,24 +13,23 @@
{-# LANGUAGE ScopedTypeVariables #-}
module Tiled2 where
-import Control.Applicative ((<|>))
-import Control.Exception (try)
-import Control.Exception.Base (SomeException)
-import Control.Monad (forM)
-import Data.Aeson hiding (Object)
-import qualified Data.Aeson as A
-import Data.Aeson.Types (Parser, typeMismatch)
-import qualified Data.ByteString as BS
-import qualified Data.ByteString.Lazy as LB
-import Data.Either.Combinators (mapLeft)
-import Data.Functor ((<&>))
-import Data.Map (Map)
-import qualified Data.Map as M
-import Data.Maybe (fromMaybe)
-import Data.Text (Text)
-import Data.Vector (Vector)
-import GHC.Exts (fromList, toList)
-import GHC.Generics (Generic)
+import Control.Applicative ((<|>))
+import Control.Exception (try)
+import Control.Exception.Base (SomeException)
+import Control.Monad (forM)
+import Data.Aeson hiding (Object)
+import qualified Data.Aeson as A
+import Data.Aeson.Types (Parser, typeMismatch)
+import qualified Data.ByteString as BS
+import qualified Data.ByteString.Lazy as LB
+import Data.Functor ((<&>))
+import Data.Map (Map)
+import qualified Data.Map as M
+import Data.Maybe (fromMaybe)
+import Data.Text (Text)
+import Data.Vector (Vector)
+import GHC.Exts (fromList, toList)
+import GHC.Generics (Generic)
-- | A globally indexed identifier.