From f141d99d8fa367d0151a0896613fed76c66bfab8 Mon Sep 17 00:00:00 2001 From: stuebinm Date: Fri, 1 Oct 2021 00:25:44 +0200 Subject: rename to walint --- lib/CheckDir.hs | 50 ++++++++++++++++++++++---------------------- lib/CheckMap.hs | 2 +- lib/Tiled2.hs | 35 +++++++++++++++---------------- tiled-hs.cabal | 64 --------------------------------------------------------- walint.cabal | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 107 insertions(+), 108 deletions(-) delete mode 100644 tiled-hs.cabal create mode 100644 walint.cabal 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/tiled-hs.cabal deleted file mode 100644 index 84f8a4b..0000000 --- a/tiled-hs.cabal +++ /dev/null @@ -1,64 +0,0 @@ -cabal-version: 2.4 -name: tiled-hs -version: 0.1.0.0 - --- A short (one-line) description of the package. --- synopsis: - --- A longer description of the package. --- description: - --- A URL where users can report bugs. --- bug-reports: - --- The license under which the package is released. --- license: -author: stuebinm -maintainer: stuebinm@disroot.org - --- A copyright notice. --- copyright: --- category: -extra-source-files: CHANGELOG.md - -library - default-language: Haskell2010 - ghc-options: -Wall - hs-source-dirs: lib - exposed-modules: - CheckMap - CheckDir - LintWriter - Properties - Tiled2 - Util - Types - Paths - build-depends: base ^>=4.14.1.0, - aeson, - bytestring, - containers, - text, - vector, - transformers, - mtl, - either, - filepath, - getopt-generics, - regex-tdfa ^>= 1.3.1.1, - extra - --- TODO: move more stuff into lib, these dependencies are silly -executable tiled-hs - main-is: Main.hs - ghc-options: -Wall - build-depends: base ^>=4.14.1.0, - tiled-hs, - getopt-generics, - aeson, - aeson-pretty, - bytestring, - bytestring-encoding, - text - hs-source-dirs: src - default-language: Haskell2010 diff --git a/walint.cabal b/walint.cabal new file mode 100644 index 0000000..1de7798 --- /dev/null +++ b/walint.cabal @@ -0,0 +1,64 @@ +cabal-version: 2.4 +name: walint +version: 0.1.0.0 + +-- A short (one-line) description of the package. +-- synopsis: + +-- A longer description of the package. +-- description: + +-- A URL where users can report bugs. +-- bug-reports: + +-- The license under which the package is released. +-- license: +author: stuebinm +maintainer: stuebinm@disroot.org + +-- A copyright notice. +-- copyright: +-- category: +extra-source-files: CHANGELOG.md + +library + default-language: Haskell2010 + ghc-options: -Wall + hs-source-dirs: lib + exposed-modules: + CheckMap + CheckDir + LintWriter + Properties + Tiled2 + Util + Types + Paths + build-depends: base ^>=4.14.1.0, + aeson, + bytestring, + containers, + text, + vector, + transformers, + mtl, + either, + filepath, + getopt-generics, + regex-tdfa, + extra + +-- TODO: move more stuff into lib, these dependencies are silly +executable walint + main-is: Main.hs + ghc-options: -Wall + build-depends: base ^>=4.14.1.0, + walint, + getopt-generics, + aeson, + aeson-pretty, + bytestring, + bytestring-encoding, + text + hs-source-dirs: src + default-language: Haskell2010 -- cgit v1.2.3