Skip to content

Commit d6553e0

Browse files
jhrcekmichaelpj
andauthored
Fix -Wall and -Wunused-packages in fourmolu and ormolu plugins (#4007)
Co-authored-by: Michael Peyton Jones <[email protected]>
1 parent 3fa2f7c commit d6553e0

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

plugins/hls-fourmolu-plugin/hls-fourmolu-plugin.cabal

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,18 @@ source-repository head
2222
type: git
2323
location: git://github.com/haskell/haskell-language-server.git
2424

25+
common warnings
26+
ghc-options: -Wall -Wunused-packages
27+
2528
library
29+
import: warnings
2630
exposed-modules:
2731
Ide.Plugin.Fourmolu
2832
hs-source-dirs: src
29-
ghc-options: -Wall
3033
build-depends:
3134
, base >=4.12 && <5
3235
, filepath
3336
, fourmolu ^>= 0.14
34-
, ghc
3537
, ghc-boot-th
3638
, ghcide == 2.6.0.0
3739
, hls-plugin-api == 2.6.0.0
@@ -45,17 +47,17 @@ library
4547
default-language: Haskell2010
4648

4749
test-suite tests
50+
import: warnings
4851
type: exitcode-stdio-1.0
4952
default-language: Haskell2010
5053
hs-source-dirs: test
5154
main-is: Main.hs
52-
ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N
55+
ghc-options: -threaded -rtsopts -with-rtsopts=-N
5356
build-tool-depends:
5457
fourmolu:fourmolu
5558
build-depends:
5659
, base >=4.12 && <5
5760
, aeson
58-
, containers
5961
, filepath
6062
, hls-fourmolu-plugin
6163
, hls-plugin-api

plugins/hls-ormolu-plugin/hls-ormolu-plugin.cabal

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,20 @@ source-repository head
2222
type: git
2323
location: https://github.com/haskell/haskell-language-server.git
2424

25+
common warnings
26+
ghc-options: -Wall -Wunused-packages
27+
2528
library
29+
import: warnings
2630
exposed-modules: Ide.Plugin.Ormolu
2731
hs-source-dirs: src
2832
build-depends:
2933
, base >=4.12 && <5
3034
, extra
3135
, filepath
32-
, ghc
3336
, ghc-boot-th
3437
, ghcide == 2.6.0.0
3538
, hls-plugin-api == 2.6.0.0
36-
, lens
3739
, lsp
3840
, mtl
3941
, process-extras >= 0.7.1
@@ -44,6 +46,7 @@ library
4446
default-language: Haskell2010
4547

4648
test-suite tests
49+
import: warnings
4750
type: exitcode-stdio-1.0
4851
default-language: Haskell2010
4952
hs-source-dirs: test
@@ -54,11 +57,9 @@ test-suite tests
5457
build-depends:
5558
, base
5659
, aeson
57-
, containers
5860
, filepath
5961
, hls-ormolu-plugin
6062
, hls-plugin-api
6163
, hls-test-utils == 2.6.0.0
6264
, lsp-types
63-
, text
6465
, ormolu

plugins/hls-ormolu-plugin/src/Ide/Plugin/Ormolu.hs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,10 @@ where
1616
import Control.Exception (Handler (..), IOException,
1717
SomeException (..), catches,
1818
handle)
19-
import Control.Monad.Except (ExceptT (ExceptT), runExceptT,
20-
throwError)
19+
import Control.Monad.Except (runExceptT, throwError)
2120
import Control.Monad.Extra
22-
import Control.Monad.IO.Class (liftIO)
2321
import Control.Monad.Trans
24-
import Control.Monad.Trans.Except (ExceptT (..), mapExceptT,
25-
runExceptT)
22+
import Control.Monad.Trans.Except (ExceptT (..), mapExceptT)
2623
import Data.Functor ((<&>))
2724
import Data.List (intercalate)
2825
import Data.Maybe (catMaybes)
@@ -38,7 +35,6 @@ import Ide.Plugin.Properties
3835
import Ide.PluginUtils
3936
import Ide.Types hiding (Config)
4037
import qualified Ide.Types as Types
41-
import Language.LSP.Protocol.Message
4238
import Language.LSP.Protocol.Types
4339
import Language.LSP.Server hiding (defaultConfig)
4440
import Ormolu

plugins/hls-ormolu-plugin/test/Main.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ module Main
55
) where
66

77
import Data.Aeson
8+
import qualified Data.Aeson.KeyMap as KM
89
import Data.Functor
9-
import qualified Data.Text as T
1010
import Ide.Plugin.Config
1111
import qualified Ide.Plugin.Ormolu as Ormolu
1212
import Language.LSP.Protocol.Types
@@ -34,9 +34,10 @@ tests = testGroup "ormolu" $
3434
]
3535

3636
goldenWithOrmolu :: Bool -> TestName -> FilePath -> FilePath -> (TextDocumentIdentifier -> Session ()) -> TestTree
37-
goldenWithOrmolu cli title path desc = goldenWithHaskellDocFormatter def ormoluPlugin "ormolu" def title testDataDir path desc "hs"
37+
goldenWithOrmolu cli title path desc =
38+
goldenWithHaskellDocFormatter def ormoluPlugin "ormolu" conf title testDataDir path desc "hs"
3839
where
39-
conf = def{plcConfig = (\(Object obj) -> obj) $ object ["external" .= cli]}
40+
conf = def{plcConfig = KM.fromList ["external" .= cli]}
4041

4142
testDataDir :: FilePath
4243
testDataDir = "test" </> "testdata"

0 commit comments

Comments
 (0)