Skip to content

Commit 4b95e55

Browse files
authored
Fix -Wall and -Wunused-packages in hlint plugin (#4019)
1 parent 70dd21e commit 4b95e55

File tree

3 files changed

+32
-49
lines changed

3 files changed

+32
-49
lines changed

haskell-language-server.cabal

Lines changed: 27 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ flag cabal
142142

143143
common cabal
144144
if flag(cabal)
145-
build-depends: haskell-language-server:hls-cabal-plugin
145+
build-depends: haskell-language-server:hls-cabal-plugin
146146
cpp-options: -Dhls_cabal
147147

148148
library hls-cabal-plugin
@@ -223,7 +223,7 @@ flag class
223223

224224
common class
225225
if flag(class)
226-
build-depends: haskell-language-server:hls-class-plugin
226+
build-depends: haskell-language-server:hls-class-plugin
227227
cpp-options: -Dhls_class
228228

229229
library hls-class-plugin
@@ -284,7 +284,7 @@ flag callHierarchy
284284

285285
common callHierarchy
286286
if flag(callHierarchy)
287-
build-depends: haskell-language-server:hls-call-hierarchy-plugin
287+
build-depends: haskell-language-server:hls-call-hierarchy-plugin
288288
cpp-options: -Dhls_callHierarchy
289289

290290
library hls-call-hierarchy-plugin
@@ -342,7 +342,7 @@ flag eval
342342

343343
common eval
344344
if flag(eval)
345-
build-depends: haskell-language-server:hls-eval-plugin
345+
build-depends: haskell-language-server:hls-eval-plugin
346346
cpp-options: -Dhls_eval
347347

348348
library hls-eval-plugin
@@ -480,7 +480,7 @@ flag rename
480480

481481
common rename
482482
if flag(rename)
483-
build-depends: haskell-language-server:hls-rename-plugin
483+
build-depends: haskell-language-server:hls-rename-plugin
484484
cpp-options: -Dhls_rename
485485

486486
library hls-rename-plugin
@@ -535,7 +535,7 @@ flag retrie
535535

536536
common retrie
537537
if flag(retrie)
538-
build-depends: haskell-language-server:hls-retrie-plugin
538+
build-depends: haskell-language-server:hls-retrie-plugin
539539
cpp-options: -Dhls_retrie
540540

541541
library hls-retrie-plugin
@@ -596,7 +596,7 @@ flag hlint
596596

597597
common hlint
598598
if flag(hlint) && (impl(ghc < 9.8.0) || flag(ignore-plugins-ghc-bounds))
599-
build-depends: haskell-language-server:hls-hlint-plugin
599+
build-depends: haskell-language-server:hls-hlint-plugin
600600
cpp-options: -Dhls_hlint
601601

602602
library hls-hlint-plugin
@@ -606,16 +606,10 @@ library hls-hlint-plugin
606606
build-depends:
607607
, aeson
608608
, base >=4.12 && <5
609-
, binary
610609
, bytestring
611610
, containers
612-
, data-default
613611
, deepseq
614-
, Diff ^>=0.4.0
615-
, directory
616-
, extra
617612
, filepath
618-
, ghc-exactprint >=0.6.3.4
619613
, ghcide == 2.6.0.0
620614
, hashable
621615
, hlint >= 3.5 && < 3.9
@@ -669,7 +663,7 @@ flag stan
669663

670664
common stan
671665
if flag(stan) && (impl(ghc > 8.8.1) && impl(ghc <= 9.2.3) || impl(ghc >= 9.4.0) && impl(ghc < 9.10.0))
672-
build-depends: haskell-language-server:hls-stan-plugin
666+
build-depends: haskell-language-server:hls-stan-plugin
673667
cpp-options: -Dhls_stan
674668

675669
library hls-stan-plugin
@@ -742,7 +736,7 @@ flag moduleName
742736

743737
common moduleName
744738
if flag(moduleName)
745-
build-depends: haskell-language-server:hls-module-name-plugin
739+
build-depends: haskell-language-server:hls-module-name-plugin
746740
cpp-options: -Dhls_moduleName
747741

748742
library hls-module-name-plugin
@@ -784,7 +778,7 @@ flag pragmas
784778

785779
common pragmas
786780
if flag(pragmas)
787-
build-depends: haskell-language-server:hls-pragmas-plugin
781+
build-depends: haskell-language-server:hls-pragmas-plugin
788782
cpp-options: -Dhls_pragmas
789783

790784
library hls-pragmas-plugin
@@ -829,7 +823,7 @@ flag splice
829823

830824
common splice
831825
if flag(splice)
832-
build-depends: haskell-language-server:hls-splice-plugin
826+
build-depends: haskell-language-server:hls-splice-plugin
833827
cpp-options: -Dhls_splice
834828

835829
library hls-splice-plugin
@@ -1001,7 +995,7 @@ flag codeRange
1001995

1002996
common codeRange
1003997
if flag(codeRange)
1004-
build-depends: haskell-language-server:hls-code-range-plugin
998+
build-depends: haskell-language-server:hls-code-range-plugin
1005999
cpp-options: -Dhls_codeRange
10061000

10071001
library hls-code-range-plugin
@@ -1058,7 +1052,7 @@ flag changeTypeSignature
10581052

10591053
common changeTypeSignature
10601054
if flag(changeTypeSignature)
1061-
build-depends: haskell-language-server:hls-change-type-signature-plugin
1055+
build-depends: haskell-language-server:hls-change-type-signature-plugin
10621056
cpp-options: -Dhls_changeTypeSignature
10631057

10641058
library hls-change-type-signature-plugin
@@ -1115,7 +1109,7 @@ flag gadt
11151109

11161110
common gadt
11171111
if flag(gadt)
1118-
build-depends: haskell-language-server:hls-gadt-plugin
1112+
build-depends: haskell-language-server:hls-gadt-plugin
11191113
cpp-options: -Dhls_gadt
11201114

11211115
library hls-gadt-plugin
@@ -1165,7 +1159,7 @@ flag explicitFixity
11651159

11661160
common explicitFixity
11671161
if flag(explicitFixity)
1168-
build-depends: haskell-language-server:hls-explicit-fixity-plugin
1162+
build-depends: haskell-language-server:hls-explicit-fixity-plugin
11691163
cpp-options: -DexplicitFixity
11701164

11711165
library hls-explicit-fixity-plugin
@@ -1209,7 +1203,7 @@ flag explicitFields
12091203

12101204
common explicitFields
12111205
if flag(explicitFields)
1212-
build-depends: haskell-language-server:hls-explicit-record-fields-plugin
1206+
build-depends: haskell-language-server:hls-explicit-record-fields-plugin
12131207
cpp-options: -DexplicitFields
12141208

12151209
library hls-explicit-record-fields-plugin
@@ -1231,7 +1225,7 @@ library hls-explicit-record-fields-plugin
12311225

12321226
if flag(pedantic)
12331227
ghc-options: -Wwarn=incomplete-record-updates
1234-
1228+
12351229
test-suite hls-explicit-record-fields-plugin-tests
12361230
import: defaults, test-defaults, warnings
12371231
type: exitcode-stdio-1.0
@@ -1255,7 +1249,7 @@ flag overloadedRecordDot
12551249

12561250
common overloadedRecordDot
12571251
if flag(overloadedRecordDot)
1258-
build-depends: haskell-language-server:hls-overloaded-record-dot-plugin
1252+
build-depends: haskell-language-server:hls-overloaded-record-dot-plugin
12591253
cpp-options: -Dhls_overloaded_record_dot
12601254

12611255
library hls-overloaded-record-dot-plugin
@@ -1302,7 +1296,7 @@ flag floskell
13021296

13031297
common floskell
13041298
if flag(floskell) && (impl(ghc < 9.7) || flag(ignore-plugins-ghc-bounds))
1305-
build-depends: haskell-language-server:hls-floskell-plugin
1299+
build-depends: haskell-language-server:hls-floskell-plugin
13061300
cpp-options: -Dhls_floskell
13071301

13081302
library hls-floskell-plugin
@@ -1341,7 +1335,7 @@ flag fourmolu
13411335

13421336
common fourmolu
13431337
if flag(fourmolu)
1344-
build-depends: haskell-language-server:hls-fourmolu-plugin
1338+
build-depends: haskell-language-server:hls-fourmolu-plugin
13451339
cpp-options: -Dhls_fourmolu
13461340

13471341
library hls-fourmolu-plugin
@@ -1391,7 +1385,7 @@ flag ormolu
13911385

13921386
common ormolu
13931387
if flag(ormolu)
1394-
build-depends: haskell-language-server:hls-ormolu-plugin
1388+
build-depends: haskell-language-server:hls-ormolu-plugin
13951389
cpp-options: -Dhls_ormolu
13961390

13971391
library hls-ormolu-plugin
@@ -1441,7 +1435,7 @@ flag stylishHaskell
14411435

14421436
common stylishHaskell
14431437
if flag(stylishHaskell) && (impl(ghc < 9.8.0) || flag(ignore-plugins-ghc-bounds))
1444-
build-depends: haskell-language-server:hls-stylish-haskell-plugin
1438+
build-depends: haskell-language-server:hls-stylish-haskell-plugin
14451439
cpp-options: -Dhls_stylishHaskell
14461440

14471441
library hls-stylish-haskell-plugin
@@ -1483,7 +1477,7 @@ flag refactor
14831477

14841478
common refactor
14851479
if flag(refactor)
1486-
build-depends: haskell-language-server:hls-refactor-plugin
1480+
build-depends: haskell-language-server:hls-refactor-plugin
14871481
cpp-options: -Dhls_refactor
14881482

14891483
library hls-refactor-plugin
@@ -1561,7 +1555,7 @@ test-suite hls-refactor-plugin-tests
15611555
hs-source-dirs: plugins/hls-refactor-plugin/test
15621556
main-is: Main.hs
15631557
other-modules: Test.AddArgument
1564-
ghc-options: -O0
1558+
ghc-options: -O0
15651559
build-depends:
15661560
, base
15671561
, filepath
@@ -1596,7 +1590,7 @@ flag semanticTokens
15961590

15971591
common semanticTokens
15981592
if flag(semanticTokens)
1599-
build-depends: haskell-language-server:hls-semantic-tokens-plugin
1593+
build-depends: haskell-language-server:hls-semantic-tokens-plugin
16001594
cpp-options: -Dhls_semanticTokens
16011595

16021596
library hls-semantic-tokens-plugin
@@ -1854,7 +1848,7 @@ test-suite func-test
18541848
type: exitcode-stdio-1.0
18551849
build-tool-depends:
18561850
haskell-language-server:haskell-language-server,
1857-
ghcide:ghcide-test-preprocessor
1851+
ghcide:ghcide-test-preprocessor
18581852

18591853
build-depends:
18601854
, bytestring
@@ -1907,7 +1901,7 @@ test-suite wrapper-test
19071901
type: exitcode-stdio-1.0
19081902
build-tool-depends:
19091903
haskell-language-server:haskell-language-server-wrapper,
1910-
haskell-language-server:haskell-language-server
1904+
haskell-language-server:haskell-language-server
19111905

19121906
build-depends:
19131907
process

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)