summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/CheckDir.hs50
-rw-r--r--lib/CheckMap.hs2
-rw-r--r--lib/Tiled2.hs35
-rw-r--r--walint.cabal (renamed from tiled-hs.cabal)8
4 files changed, 47 insertions, 48 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.
diff --git a/tiled-hs.cabal b/walint.cabal
index 84f8a4b..1de7798 100644
--- a/tiled-hs.cabal
+++ b/walint.cabal
@@ -1,5 +1,5 @@
cabal-version: 2.4
-name: tiled-hs
+name: walint
version: 0.1.0.0
-- A short (one-line) description of the package.
@@ -45,15 +45,15 @@ library
either,
filepath,
getopt-generics,
- regex-tdfa ^>= 1.3.1.1,
+ regex-tdfa,
extra
-- TODO: move more stuff into lib, these dependencies are silly
-executable tiled-hs
+executable walint
main-is: Main.hs
ghc-options: -Wall
build-depends: base ^>=4.14.1.0,
- tiled-hs,
+ walint,
getopt-generics,
aeson,
aeson-pretty,