summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Biz/Bild.hs2
-rw-r--r--Biz/Lint.hs7
-rw-r--r--Biz/Namespace.hs7
3 files changed, 10 insertions, 6 deletions
diff --git a/Biz/Bild.hs b/Biz/Bild.hs
index 7df1fae..43be7b0 100644
--- a/Biz/Bild.hs
+++ b/Biz/Bild.hs
@@ -151,7 +151,7 @@ move :: Cli.Arguments -> IO ()
move args =
IO.hSetBuffering stdout IO.NoBuffering
>> pure (Cli.getAllArgs args (Cli.argument "target"))
- /> filter (not <. ("_" `List.isPrefixOf`))
+ /> filter (not <. Namespace.isCab)
+> filterM Dir.doesFileExist
+> traverse (\fn -> analyze fn /> (fn,))
/> filter (snd .> isJust)
diff --git a/Biz/Lint.hs b/Biz/Lint.hs
index 8d5a757..82e52cc 100644
--- a/Biz/Lint.hs
+++ b/Biz/Lint.hs
@@ -14,6 +14,7 @@ import Biz.Namespace (Ext (..), Namespace (..))
import qualified Biz.Namespace as Namespace
import Biz.Test ((@=?))
import qualified Biz.Test as Test
+import qualified Data.List as List
import Data.Maybe (fromJust)
import qualified Data.String as String
import qualified Data.Text as Text
@@ -31,7 +32,7 @@ move args = case Cli.getAllArgs args (Cli.argument "file") of
[] -> changedFiles +> run shouldFix +> exit
files ->
files
- |> filter notcab
+ |> filter (not <. Namespace.isCab)
|> filterM Directory.doesFileExist
+> run shouldFix
+> exit
@@ -47,10 +48,6 @@ test =
length results @=? 2
]
-notcab :: FilePath -> Bool
-notcab ('_' : _) = False
-notcab _ = True
-
help :: Cli.Docopt
help =
[Cli.docopt|
diff --git a/Biz/Namespace.hs b/Biz/Namespace.hs
index c3252fd..2312271 100644
--- a/Biz/Namespace.hs
+++ b/Biz/Namespace.hs
@@ -13,6 +13,7 @@ module Biz.Namespace
toPath,
toHaskellModule,
toSchemeModule,
+ isCab,
)
where
@@ -86,3 +87,9 @@ reExt =
<|> Sh <$ Regex.string "sh"
<|> Keys <$ Regex.string "pub"
<|> Json <$ Regex.string "json"
+
+-- | The cab dir is for temporary files and build outputs, not for source
+-- inputs.
+isCab :: FilePath -> Bool
+isCab ('_' : _) = True
+isCab fp = "_" `List.isInfixOf` fp