packages feed

smuggler2 0.3.5.1 → 0.3.5.2

raw patch · 7 files changed

+92/−16 lines, 7 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

+ .hlint.yaml view
@@ -0,0 +1,60 @@+# HLint configuration file+# https://github.com/ndmitchell/hlint+##########################++# This file contains a template configuration file, which is typically+# placed as .hlint.yaml in the root of your project+++# Specify additional command line arguments+#+# - arguments: [--color, --cpp-simple, -XQuasiQuotes]+++# Control which extensions/flags/modules/functions can be used+#+# - extensions:+#   - default: false # all extension are banned by default+#   - name: [PatternGuards, ViewPatterns] # only these listed extensions can be used+#   - {name: CPP, within: CrossPlatform} # CPP can only be used in a given module+#+# - flags:+#   - {name: -w, within: []} # -w is allowed nowhere+#+# - modules:+#   - {name: [Data.Set, Data.HashSet], as: Set} # if you import Data.Set qualified, it must be as 'Set'+#   - {name: Control.Arrow, within: []} # Certain modules are banned entirely+#+# - functions:+#   - {name: unsafePerformIO, within: []} # unsafePerformIO can only appear in no modules+++# Add custom hints for this project+#+# Will suggest replacing "wibbleMany [myvar]" with "wibbleOne myvar"+# - error: {lhs: "wibbleMany [x]", rhs: wibbleOne x}+++# Turn on hints that are off by default+#+# Ban "module X(module X) where", to require a real export list+# - warn: {name: Use explicit module export list}+#+# Replace a $ b $ c with a . b $ c+# - group: {name: dollar, enabled: true}+#+# Generalise map to fmap, ++ to <>+# - group: {name: generalise, enabled: true}+++# Ignore some builtin hints+# - ignore: {name: Use let}+# - ignore: {name: Use const, within: SpecialModule} # Only within certain modules+- ignore: {name: "Use camelCase", within: Smuggler2.Imports}++# Define some custom infix operators+# - fixity: infixr 3 ~^#^~+++# To generate a suitable file for HLint do:+# $ hlint --default > .hlint.yaml
CHANGELOG.md view
@@ -5,6 +5,9 @@ `smuggler2` uses [PVP Versioning][1]. The change log is available [on GitHub][2]. +##  [0.3.5.2]: --  15 June 2020+- tweaks to allow `smuggler2` to run under Windows+ ##  [0.3.5.1]: --  14 June 2020 - fix bug that left some files with open imports unprocessed - add `LeaveOpenImports` and `MakeOpenImports` options
Makefile view
@@ -1,15 +1,20 @@ # For convenience # -.PHONY: build install test clean accept doc hlint ghcid upload weed+.PHONY: build install test clean accept doc hlint ghcid upload upload-docs weed  all: build test doc  build: 	# Creates a package environment file needed to get the tests to run in some-	# environments (eg, travis)+	# environments (eg, travis).  Use with care as it can lead to unexpected+	# results if you are not aware that ghc is using it; it is a normally hidden+	# dot file. 	cabal build # --write-ghc-environment-files=always +debug:+	cabal build -fdebug+ install: 	cabal install --lib smuggler2 	cabal install exe:ghc-smuggler2 --overwrite-policy=always@@ -33,9 +38,11 @@ 	cabal check 	cabal gen-bounds 	cabal sdist-	cabal haddock --haddock-for-hackage --enable-doc --haddock-option=--hyperlinked-source 	cabal upload dist-newstyle/sdist/smuggler2-0.3.*.*.tar.gz-#	cabal upload -d --publish dist-newstyle/smuggler2-0.3.*.*-docs.tar.gz++upload-docs:+	cabal haddock --haddock-for-hackage --enable-doc --haddock-option=--hyperlinked-source+	cabal upload -d --publish dist-newstyle/smuggler2-0.3.*.*-docs.tar.gz  hlint: 	hlint src test/Test.hs
README.md view
@@ -220,7 +220,7 @@ * `hiding` clauses may not be properly analysed. So hiding things that are not   used may not be spotted. -* The test suite does not seem to run reliably on Windows. This is probably more+* The plugin does not seem to run reliably on Windows. This is probably more   of an issue with the way that the tests are run, than `Smuggler2` itself.  * Currently `cabal` does not have a particular way of specifying plugins. (See,@@ -239,9 +239,14 @@   versions of GHC don't. The results compile on `ghc-8.6.5` and later anyway,   but the imports are not as minimal for later versions as they could be. - `cabal >= 3.0` (ideally `3.2`)+- The Windows version of the plugin is a bit flaky because of apparent compiler+  bugs.  ### How to build +There is a `Makefile` at the root of the distribution that covers various+maintenance tasks, including building the package.+ ```shell $ cabal update $ cabal build@@ -287,8 +292,6 @@ command that is to be used to do that can be set using the `CABAL` environment variable. This may be helpful for certain workflows where `cabal` is not in the current path, or you want to add extra flags to the `cabal` command.--The test suite does not seem to run reliably on Windows  Importing a test module from another test module in the same directory is likely to lead to race conditions as 'Tasty' runs tests in parallel and so will try to
smuggler2.cabal view
@@ -1,6 +1,6 @@ cabal-version:      3.0 name:               smuggler2-version:            0.3.5.1+version:            0.3.5.2 synopsis:   GHC Source Plugin that helps to minimise imports and generate explicit exports @@ -37,6 +37,7 @@   Makefile   Setup.hs   weeder.dhall+  .hlint.yaml  -- wildcards are allowed only in the basename --test/tests/*.*-golden
src/Smuggler2/Plugin.hs view
@@ -13,7 +13,7 @@ import Data.List (intersect) import Data.Maybe (fromMaybe, isJust, isNothing) import Data.Version (showVersion)-import DynFlags (DynFlags (dumpDir), HasDynFlags (getDynFlags), xopt)+import DynFlags (DynFlags (dumpDir), HasDynFlags (getDynFlags), setUnsafeGlobalDynFlags, xopt) import ErrUtils (compilationProgressMsg, fatalErrorMsg, warningMsg) import GHC   ( GenLocated (L),@@ -92,6 +92,7 @@     return tcEnv   | otherwise = do     dflags <- getDynFlags+    liftIO $ setUnsafeGlobalDynFlags dflags -- this seems to be needed for Windows only     liftIO $ compilationProgressMsg dflags ("smuggler2 " ++ showVersion version)      -- Get imports  usage
test/Test.hs view
@@ -6,12 +6,12 @@ import Data.List (intercalate, sort) import Data.Maybe (fromMaybe) import qualified Data.Set as Set (fromList, member)-import GHC.Paths (ghc) import GHC (mkModuleName, moduleNameString)+import GHC.Paths (ghc) import Smuggler2.Options (ExportAction (..), ImportAction (..), Options (..)) import System.Directory (doesDirectoryExist, getDirectoryContents) import System.Environment (lookupEnv)-import System.FilePath ((-<.>), (</>), takeBaseName, takeExtension)+import System.FilePath (takeBaseName, takeExtension, (-<.>), (</>)) import System.Process.Typed   ( ProcessConfig,     proc,@@ -51,7 +51,7 @@ mkExt ia ea lo mo =   show ia     ++ show ea-    ++ filter (/= '.') ( concat lo ++ concat mo ) -- ++ "-" ++ takeFileName ghc+    ++ filter (/= '.') (concat lo ++ concat mo) -- ++ "-" ++ takeFileName ghc  -- | Generate test for a list of 'Options' each of which specify what action to -- take on imports and exports@@ -69,9 +69,11 @@       testName       [ goldenVsFileDiff           (takeBaseName testFile) -- test name-          -- The -G. is needed because cabal sdist changes the golden file-          -- permissions and so all the tests fail.-          (\ref new -> ["git", "diff", "--no-index", "-G.", ref, new]) -- how to display diffs+          ( \ref new -> -- how to display diffs+              -- The -G. is needed because cabal sdist changes the golden file+              -- permissions and so all the tests fail.+              ["git", "diff", "-G.", "--ignore-cr-at-eol", "--no-index", ref, new]+          )           (testFile -<.> testName ++ "-golden") -- golden file           outputFilename           ( do@@ -85,7 +87,6 @@       ]   where     testName = fromMaybe "NoNewExtension" (newExtension opts)- -- | A version of 'Test.Tasty.Golden.findByExtension' that does not look into -- subdirectories.  This allows tests to be run on a module that imports other -- modules without risking the race condition where smuggler is being run