Skip to content

Commit a92f44a

Browse files
committed
Fix -Wall and -Wunused-packages in hlint plugin
1 parent 90eed1a commit a92f44a

File tree

3 files changed

+7
-25
lines changed

3 files changed

+7
-25
lines changed

haskell-language-server.cabal

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -619,21 +619,16 @@ common hlint
619619
cpp-options: -Dhls_hlint
620620

621621
library hls-hlint-plugin
622+
import: warnings
622623
exposed-modules: Ide.Plugin.Hlint
623624
hs-source-dirs: plugins/hls-hlint-plugin/src
624625
build-depends:
625626
, aeson
626627
, base >=4.12 && <5
627-
, binary
628628
, bytestring
629629
, containers
630-
, data-default
631630
, deepseq
632-
, Diff ^>=0.4.0
633-
, directory
634-
, extra
635631
, filepath
636-
, ghc-exactprint >=0.6.3.4
637632
, ghcide == 2.6.0.0
638633
, hashable
639634
, hlint >= 3.5 && < 3.9
@@ -653,9 +648,6 @@ library hls-hlint-plugin
653648
, apply-refact
654649

655650
cpp-options: -DHLINT_ON_GHC_LIB
656-
ghc-options:
657-
-Wall -Wredundant-constraints -Wno-name-shadowing
658-
-Wno-unticked-promoted-constructors
659651

660652
if flag(pedantic)
661653
ghc-options: -Werror
@@ -666,6 +658,7 @@ library hls-hlint-plugin
666658
TypeOperators
667659

668660
test-suite hls-hlint-plugin-tests
661+
import: warnings
669662
type: exitcode-stdio-1.0
670663
default-language: Haskell2010
671664
hs-source-dirs: plugins/hls-hlint-plugin/test

plugins/hls-hlint-plugin/src/Ide/Plugin/Hlint.hs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
{-# LANGUAGE ScopedTypeVariables #-}
1717
{-# LANGUAGE StrictData #-}
1818
{-# LANGUAGE TupleSections #-}
19-
{-# LANGUAGE TypeApplications #-}
2019
{-# LANGUAGE TypeFamilies #-}
2120
{-# LANGUAGE ViewPatterns #-}
2221
{-# OPTIONS_GHC -Wno-orphans #-}
@@ -142,8 +141,7 @@ import Development.IDE.Spans.Pragmas (LineSplitTe
142141
lineSplitTextEdits,
143142
nextPragmaLine)
144143
import GHC.Generics (Generic)
145-
#if MIN_VERSION_apply_refact(0,12,0)
146-
#else
144+
#if !MIN_VERSION_apply_refact(0,12,0)
147145
import System.Environment (setEnv,
148146
unsetEnv)
149147
#endif

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

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,16 @@ module Main
99

1010
import Control.Lens ((^.))
1111
import Control.Monad (when)
12-
import Data.Aeson (Value (..), object, toJSON, (.=))
12+
import Data.Aeson (Value (..), object, (.=))
1313
import Data.Functor (void)
1414
import Data.List (find)
1515
import qualified Data.Map as Map
1616
import Data.Maybe (fromJust, isJust)
1717
import Data.Row ((.+), (.==))
1818
import qualified Data.Text as T
19-
import Ide.Plugin.Config (Config (..), PluginConfig (..))
19+
import Ide.Plugin.Config (Config (..))
2020
import qualified Ide.Plugin.Config as Plugin
2121
import qualified Ide.Plugin.Hlint as HLint
22-
import Ide.Types (PluginId)
2322
import qualified Language.LSP.Protocol.Lens as L
2423
import System.FilePath ((</>))
2524
import Test.Hls
@@ -383,10 +382,6 @@ data Point = Point {
383382
column :: !Int
384383
}
385384

386-
makePoint line column
387-
| line >= 1 && column >= 1 = Point line column
388-
| otherwise = error "Line or column is less than 1."
389-
390385
pointToRange :: Point -> Range
391386
pointToRange Point {..}
392387
| line <- fromIntegral $ subtract 1 line
@@ -402,10 +397,6 @@ makeCodeActionNotFoundAtString :: Point -> String
402397
makeCodeActionNotFoundAtString Point {..} =
403398
"CodeAction not found at line: " <> show line <> ", column: " <> show column
404399

405-
makeCodeActionFoundAtString :: Point -> String
406-
makeCodeActionFoundAtString Point {..} =
407-
"CodeAction found at line: " <> show line <> ", column: " <> show column
408-
409400
ignoreHintGoldenTest :: TestName -> FilePath -> Point -> T.Text -> TestTree
410401
ignoreHintGoldenTest testCaseName goldenFilename point hintName =
411402
goldenTest testCaseName goldenFilename point (getIgnoreHintText hintName)
@@ -417,7 +408,7 @@ applyHintGoldenTest testCaseName goldenFilename point hintName = do
417408
goldenTest :: TestName -> FilePath -> Point -> T.Text -> TestTree
418409
goldenTest testCaseName goldenFilename point hintText =
419410
setupGoldenHlintTest testCaseName goldenFilename $ \document -> do
420-
waitForDiagnosticsFromSource document "hlint"
411+
_ <- waitForDiagnosticsFromSource document "hlint"
421412
actions <- getCodeActions document $ pointToRange point
422413
case find ((== Just hintText) . getCodeActionTitle) actions of
423414
Just (InR codeAction) -> do
@@ -441,7 +432,7 @@ applyHintGoldenResolveTest testCaseName goldenFilename point hintName = do
441432
goldenResolveTest :: TestName -> FilePath -> Point -> T.Text -> TestTree
442433
goldenResolveTest testCaseName goldenFilename point hintText =
443434
setupGoldenHlintResolveTest testCaseName goldenFilename $ \document -> do
444-
waitForDiagnosticsFromSource document "hlint"
435+
_ <- waitForDiagnosticsFromSource document "hlint"
445436
actions <- getAndResolveCodeActions document $ pointToRange point
446437
case find ((== Just hintText) . getCodeActionTitle) actions of
447438
Just (InR codeAction) -> executeCodeAction codeAction

0 commit comments

Comments
 (0)