splint 1.0.1.4 → 1.0.1.5
raw patch · 15 files changed
+32/−113 lines, 15 filesdep ~ghcdep ~hlint
Dependency ranges changed: ghc, hlint
Files
- LICENSE.markdown +1/−1
- splint.cabal +7/−18
- src/ghc-8.10/Splint/GHC/Bag.hs +0/−3
- src/ghc-8.10/Splint/GHC/Error.hs +0/−3
- src/ghc-8.10/Splint/GHC/Plugins.hs +0/−3
- src/ghc-8.10/Splint/Parser.hs +0/−15
- src/ghc-8.8/Splint/GHC/Bag.hs +0/−3
- src/ghc-8.8/Splint/GHC/Error.hs +0/−3
- src/ghc-8.8/Splint/GHC/Plugins.hs +0/−3
- src/ghc-8.8/Splint/Parser.hs +0/−32
- src/ghc-9.0/Splint/GHC/Bag.hs +0/−3
- src/ghc-9.0/Splint/GHC/Error.hs +0/−3
- src/ghc-9.0/Splint/GHC/Plugins.hs +0/−3
- src/ghc-9.0/Splint/Parser.hs +0/−15
- src/lib/Splint.hs +24/−5
LICENSE.markdown view
@@ -1,4 +1,4 @@-Copyright 2021 Taylor Fausak+Copyright 2022 Taylor Fausak Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above
splint.cabal view
@@ -1,7 +1,7 @@ cabal-version: >= 1.10 name: splint-version: 1.0.1.4+version: 1.0.1.5 synopsis: HLint as a GHC source plugin. description:@@ -25,8 +25,8 @@ build-depends: base >= 4.13.0 && < 4.16 , containers >= 0.6.2 && < 0.7- , ghc >= 8.8.4 && < 8.11 || >= 9.0.1 && < 9.1- , hlint >= 3.1.6 && < 3.4+ , ghc >= 8.10 && < 8.11 || >= 9.0 && < 9.1+ , hlint , stm >= 2.5.0 && < 2.6 default-language: Haskell2010 exposed-modules: Splint@@ -37,23 +37,12 @@ -Wno-missing-export-lists -Wno-missing-exported-signatures -Wno-missing-import-lists+ -Wno-missing-safe-haskell-mode+ -Wno-prepositive-qualified-module -Wno-unsafe hs-source-dirs: src/lib- other-modules:- Splint.GHC.Bag- Splint.GHC.Error- Splint.GHC.Plugins- Splint.Parser if impl(ghc >= 9.0)- hs-source-dirs: src/ghc-9.0+ build-depends: hlint >= 3.3 && < 3.4 else- if impl(ghc >= 8.10)- hs-source-dirs: src/ghc-8.10- else- hs-source-dirs: src/ghc-8.8-- if impl(ghc >= 8.10)- ghc-options:- -Wno-missing-safe-haskell-mode- -Wno-prepositive-qualified-module+ build-depends: hlint >= 3.2 && < 3.3
− src/ghc-8.10/Splint/GHC/Bag.hs
@@ -1,3 +0,0 @@-module Splint.GHC.Bag ( module Export ) where--import Bag as Export
− src/ghc-8.10/Splint/GHC/Error.hs
@@ -1,3 +0,0 @@-module Splint.GHC.Error ( module Export ) where--import ErrUtils as Export
− src/ghc-8.10/Splint/GHC/Plugins.hs
@@ -1,3 +0,0 @@-module Splint.GHC.Plugins ( module Export ) where--import GhcPlugins as Export
− src/ghc-8.10/Splint/Parser.hs
@@ -1,15 +0,0 @@-module Splint.Parser where--import qualified Language.Haskell.HLint as HLint-import qualified Splint.GHC.Plugins as GHC--parse- :: HLint.ParseFlags- -> GHC.ModSummary- -> GHC.HsParsedModule- -> GHC.Hsc HLint.ModuleEx-parse _ _ hsParsedModule = do- let- apiAnns = GHC.hpm_annotations hsParsedModule- hsModule = GHC.hpm_module hsParsedModule- pure $ HLint.createModuleEx apiAnns hsModule
− src/ghc-8.8/Splint/GHC/Bag.hs
@@ -1,3 +0,0 @@-module Splint.GHC.Bag ( module Export ) where--import Bag as Export
− src/ghc-8.8/Splint/GHC/Error.hs
@@ -1,3 +0,0 @@-module Splint.GHC.Error ( module Export ) where--import ErrUtils as Export
− src/ghc-8.8/Splint/GHC/Plugins.hs
@@ -1,3 +0,0 @@-module Splint.GHC.Plugins ( module Export ) where--import GhcPlugins as Export
− src/ghc-8.8/Splint/Parser.hs
@@ -1,32 +0,0 @@-module Splint.Parser where--import qualified Control.Exception as Exception-import qualified Language.Haskell.HLint as HLint-import qualified Splint.GHC.Plugins as GHC--parse- :: HLint.ParseFlags- -> GHC.ModSummary- -> GHC.HsParsedModule- -> GHC.Hsc HLint.ModuleEx-parse parseFlags modSummary _ = GHC.liftIO $ do- let filePath = GHC.msHsFilePath modSummary- result <- HLint.parseModuleEx parseFlags filePath Nothing- case result of- Left parseError -> Exception.throwIO $ ParseError parseError- Right moduleEx -> pure moduleEx--newtype ParseError = ParseError HLint.ParseError--instance Exception.Exception ParseError--instance Show ParseError where- show (ParseError parseError) = mconcat- [ "ParseError { parseErrorLocation = "- , show $ HLint.parseErrorLocation parseError- , ", parseErrorMessage = "- , show $ HLint.parseErrorMessage parseError- , ", parseErrorContents = "- , show $ HLint.parseErrorContents parseError- , " }"- ]
− src/ghc-9.0/Splint/GHC/Bag.hs
@@ -1,3 +0,0 @@-module Splint.GHC.Bag ( module Export ) where--import GHC.Data.Bag as Export
− src/ghc-9.0/Splint/GHC/Error.hs
@@ -1,3 +0,0 @@-module Splint.GHC.Error ( module Export ) where--import GHC.Utils.Error as Export
− src/ghc-9.0/Splint/GHC/Plugins.hs
@@ -1,3 +0,0 @@-module Splint.GHC.Plugins ( module Export ) where--import GHC.Plugins as Export
− src/ghc-9.0/Splint/Parser.hs
@@ -1,15 +0,0 @@-module Splint.Parser where--import qualified Language.Haskell.HLint as HLint-import qualified Splint.GHC.Plugins as GHC--parse- :: HLint.ParseFlags- -> GHC.ModSummary- -> GHC.HsParsedModule- -> GHC.Hsc HLint.ModuleEx-parse _ _ hsParsedModule = do- let- apiAnns = GHC.hpm_annotations hsParsedModule- hsModule = GHC.hpm_module hsParsedModule- pure $ HLint.createModuleEx apiAnns hsModule
src/lib/Splint.hs view
@@ -1,20 +1,28 @@+{-# LANGUAGE CPP #-}+ module Splint ( plugin ) where -import qualified Splint.GHC.Bag as GHC import qualified Control.Concurrent as Concurrent import qualified Control.Concurrent.STM as Stm import qualified Control.Exception as Exception import qualified Control.Monad.IO.Class as IO import qualified Data.Map as Map-import qualified Splint.GHC.Error as GHC-import qualified Splint.GHC.Plugins as GHC import qualified Language.Haskell.HLint as HLint-import qualified Splint.Parser as Splint import qualified System.IO.Unsafe as Unsafe +# if MIN_VERSION_GLASGOW_HASKELL(9, 0, 0, 0)+import qualified GHC.Data.Bag as GHC+import qualified GHC.Utils.Error as GHC+import qualified GHC.Plugins as GHC+# else+import qualified Bag as GHC+import qualified ErrUtils as GHC+import qualified GhcPlugins as GHC+# endif+ plugin :: GHC.Plugin plugin = GHC.defaultPlugin { GHC.parsedResultAction = action@@ -28,7 +36,7 @@ -> GHC.Hsc GHC.HsParsedModule action commandLineOptions modSummary hsParsedModule = do (parseFlags, classifies, hint) <- getSettings commandLineOptions- moduleEx <- Splint.parse parseFlags modSummary hsParsedModule+ moduleEx <- parse parseFlags modSummary hsParsedModule dynFlags <- GHC.getDynFlags io . GHC.printOrThrowWarnings dynFlags@@ -124,3 +132,14 @@ _ -> GHC.empty , GHC.vcat . fmap (GHC.text . mappend "Note: " . show) $ HLint.ideaNote idea ]++parse+ :: HLint.ParseFlags+ -> GHC.ModSummary+ -> GHC.HsParsedModule+ -> GHC.Hsc HLint.ModuleEx+parse _ _ hsParsedModule = do+ let+ apiAnns = GHC.hpm_annotations hsParsedModule+ hsModule = GHC.hpm_module hsParsedModule+ pure $ HLint.createModuleEx apiAnns hsModule