Skip to content

Commit 4985793

Browse files
authored
Actually enable pedantic flag in ci flags job (#4224)
* Actually enable pedantic flag in ci flags job * Address reviwe comments * Fixes after rebase * Tweak warning configs
1 parent 61fd5c4 commit 4985793

File tree

11 files changed

+56
-65
lines changed

11 files changed

+56
-65
lines changed

.github/workflows/flags.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ jobs:
7676
- name: Configue non-default flags for all components
7777
run: |
7878
cabal configure \
79-
--constraint "hls-graph +embed-files +stm-stats" \
79+
--constraint "haskell-language-server +pedantic" \
80+
--constraint "hls-graph +embed-files +pedantic +stm-stats" \
8081
--constraint "ghcide +ekg +executable +test-exe" \
81-
--constraint "hls-plugin-api -use-fingertree" \
82-
--constraint "all +pedantic"
82+
--constraint "hls-plugin-api +pedantic -use-fingertree"
8383
cat cabal.project.local
8484
8585
- name: Build everything with non-default flags

.hlint.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@
9494
- Main
9595
- Experiments
9696
- Development.Benchmark.Rules
97-
- Development.IDE.Plugin.CodeAction
9897
- Development.IDE.Plugin.Completions
9998
- Development.IDE.Plugin.CodeAction.ExactPrint
10099
- Development.IDE.Spans.Documentation

ghcide/exe/Main.hs

-3
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,11 @@ module Main(main) where
66

77
import Arguments (Arguments (..),
88
getArguments)
9-
import Control.Monad.Extra (unless)
109
import Control.Monad.IO.Class (liftIO)
1110
import Data.Default (def)
1211
import Data.Function ((&))
1312
import Data.Version (showVersion)
1413
import Development.GitRev (gitHash)
15-
import Development.IDE (action)
16-
import Development.IDE.Core.OfInterest (kick)
1714
import Development.IDE.Core.Rules (mainRule)
1815
import qualified Development.IDE.Core.Rules as Rules
1916
import Development.IDE.Core.Tracing (withTelemetryRecorder)

ghcide/test/exe/DiagnosticTests.hs

+2-4
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,8 @@ import Control.Monad.Extra (whenJust)
3636
import Data.Default (def)
3737
import Development.IDE.Plugin.Test (WaitForIdeRuleResult (..))
3838
import System.Time.Extra
39-
import Test.Hls (runSessionWithServer',
40-
runSessionWithServerInTmpDirCont,
41-
waitForProgressBegin,
42-
waitForTypecheck)
39+
import Test.Hls (runSessionWithServerInTmpDirCont,
40+
waitForProgressBegin)
4341
import Test.Hls.FileSystem (directCradle, file, text,
4442
toAbsFp)
4543
import Test.Tasty

ghcide/test/exe/TestUtils.hs

+17-26
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,37 @@
1-
21
{-# LANGUAGE GADTs #-}
32

43
module TestUtils where
54

6-
import Control.Applicative.Combinators
75
import Control.Concurrent.Async
8-
import Control.Exception (bracket_, finally)
9-
import Control.Lens ((.~))
10-
import qualified Control.Lens as Lens
11-
import qualified Control.Lens.Extras as Lens
12-
import Control.Monad
6+
import Control.Exception (bracket_, finally)
137
import Data.Foldable
14-
import Data.Function ((&))
158
import Data.Maybe
16-
import Development.IDE.GHC.Compat (GhcVersion (..), ghcVersion)
17-
import qualified Development.IDE.Main as IDE
18-
import Development.IDE.Test (configureCheckProject,
19-
expectNoMoreDiagnostics)
9+
import Development.IDE.GHC.Compat (GhcVersion (..), ghcVersion)
10+
import qualified Development.IDE.Main as IDE
11+
import Development.IDE.Test (configureCheckProject,
12+
expectNoMoreDiagnostics)
2013
import Development.IDE.Test.Runfiles
2114
import Development.IDE.Types.Location
22-
import Development.Shake (getDirectoryFilesIO)
23-
import Ide.Logger (Recorder, WithPriority,
24-
cmapWithPrio)
25-
import qualified Language.LSP.Protocol.Lens as L
26-
import Language.LSP.Protocol.Message
27-
import Language.LSP.Protocol.Types hiding
28-
(SemanticTokenAbsolute (..),
29-
SemanticTokenRelative (..),
30-
SemanticTokensEdit (..),
31-
mkRange)
15+
import Development.Shake (getDirectoryFilesIO)
16+
import Ide.Logger (Recorder, WithPriority,
17+
cmapWithPrio)
18+
import Language.LSP.Protocol.Types hiding
19+
(SemanticTokenAbsolute (..),
20+
SemanticTokenRelative (..),
21+
SemanticTokensEdit (..),
22+
mkRange)
3223
import Language.LSP.Test
3324
import System.Directory
34-
import System.Environment.Blank (getEnv, setEnv, unsetEnv)
25+
import System.Environment.Blank (getEnv, setEnv, unsetEnv)
3526
import System.FilePath
36-
import System.Info.Extra (isMac, isWindows)
27+
import System.Info.Extra (isMac, isWindows)
3728
import qualified System.IO.Extra
38-
import System.Process.Extra (createPipe)
29+
import System.Process.Extra (createPipe)
3930
import Test.Tasty
4031
import Test.Tasty.ExpectedFailure
4132
import Test.Tasty.HUnit
4233

43-
import Config (lspTestCaps)
34+
import Config (lspTestCaps)
4435
import LogType
4536

4637

haskell-language-server.cabal

+18-19
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ common defaults
4444
default-extensions: ExplicitNamespaces
4545

4646
common test-defaults
47-
ghc-options: -threaded -rtsopts -with-rtsopts=-N
47+
ghc-options: -threaded -rtsopts -with-rtsopts=-N
48+
if impl(ghc >= 9.8)
49+
-- We allow using partial functions in tests
50+
ghc-options: -Wno-x-partial
4851

4952
-- Default warnings in HLS
5053
common warnings
@@ -1676,25 +1679,23 @@ test-suite hls-refactor-plugin-tests
16761679
ghc-options: -O0
16771680
build-depends:
16781681
, base
1682+
, data-default
1683+
, directory
1684+
, extra
16791685
, filepath
1686+
, ghcide:ghcide
16801687
, haskell-language-server:hls-refactor-plugin
16811688
, hls-test-utils == 2.8.0.0
16821689
, lens
1690+
, lsp-test
16831691
, lsp-types
1684-
, text
1685-
, hls-plugin-api
16861692
, parser-combinators
1687-
, data-default
1688-
, extra
1689-
, ghcide:ghcide
1690-
, shake
1691-
, hls-plugin-api
1692-
, lsp-test
1693-
, directory
16941693
, regex-tdfa
1695-
, tasty-hunit
1696-
, tasty-expected-failure
1694+
, shake
16971695
, tasty
1696+
, tasty-expected-failure
1697+
, tasty-hunit
1698+
, text
16981699

16991700
-----------------------------
17001701
-- semantic tokens plugin
@@ -1763,19 +1764,17 @@ test-suite hls-semantic-tokens-plugin-tests
17631764
, aeson
17641765
, base
17651766
, containers
1767+
, data-default
17661768
, filepath
1769+
, ghcide == 2.8.0.0
17671770
, haskell-language-server:hls-semantic-tokens-plugin
1768-
, hls-test-utils == 2.8.0.0
1769-
, hls-plugin-api
1771+
, hls-plugin-api == 2.8.0.0
1772+
, hls-test-utils == 2.8.0.0
17701773
, lens
17711774
, lsp
1772-
, text-rope
17731775
, lsp-test
17741776
, text
1775-
, data-default
1776-
, ghcide == 2.8.0.0
1777-
, hls-plugin-api == 2.8.0.0
1778-
, data-default
1777+
, text-rope
17791778

17801779
-----------------------------
17811780
-- notes plugin

hls-test-utils/hls-test-utils.cabal

+5-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ library
5757
, temporary
5858
, text
5959

60-
ghc-options: -Wall -Wunused-packages -Wno-name-shadowing
60+
ghc-options:
61+
-Wall
62+
-Wunused-packages
63+
-Wno-name-shadowing
64+
-Wno-unticked-promoted-constructors
6165

6266
if flag(pedantic)
6367
ghc-options: -Werror

plugins/hls-alternate-number-format-plugin/src/Ide/Plugin/Literals.hs

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ module Ide.Plugin.Literals (
99

1010
import Data.Maybe (maybeToList)
1111
import Data.Text (Text)
12-
import qualified Data.Text as T
1312
#if __GLASGOW_HASKELL__ >= 908
1413
import qualified Data.Text.Encoding as T
14+
#else
15+
import qualified Data.Text as T
1516
#endif
1617
import Development.IDE.GHC.Compat hiding (getSrcSpan)
1718
import Development.IDE.Graph.Classes (NFData (rnf))

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

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{-# LANGUAGE LambdaCase #-}
2-
{-# LANGUAGE OverloadedLabels #-}
32
{-# LANGUAGE OverloadedLists #-}
43
{-# LANGUAGE OverloadedStrings #-}
54

plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Parse/Comments.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ We build parsers combining the following three kinds of them:
5757
-}
5858

5959
-- | Line parser
60-
type LineParser a = forall m. Monad m => ParsecT Void String m a
60+
type LineParser a = forall m. ParsecT Void String m a
6161

6262
-- | Line comment group parser
6363
type LineGroupParser = Parsec Void [(Range, RawLineComment)]

plugins/hls-refactor-plugin/src/Development/IDE/Plugin/CodeAction.hs

+8-5
Original file line numberDiff line numberDiff line change
@@ -1085,11 +1085,14 @@ suggestImportDisambiguation df (Just txt) ps fileContents diag@Diagnostic {..}
10851085
_ -> False
10861086
]
10871087
++ [HideOthers restImports | not (null restImports)]
1088-
] ++ [ ( renderUniquify mode T.empty symbol True
1089-
, disambiguateSymbol ps fileContents diag symbol mode
1090-
) | local, not (null targetsWithRestImports)
1091-
, let mode = HideOthers (uncurry (:) (head targetsWithRestImports))
1092-
]
1088+
] ++ case targetsWithRestImports of
1089+
(m,ms):_ | local ->
1090+
let mode = HideOthers (m:ms)
1091+
in [( renderUniquify mode T.empty symbol True
1092+
, disambiguateSymbol ps fileContents diag symbol mode
1093+
)]
1094+
_ -> []
1095+
10931096
renderUniquify HideOthers {} modName symbol local =
10941097
"Use " <> (if local then "local definition" else modName) <> " for " <> symbol <> ", hiding other imports"
10951098
renderUniquify (ToQualified _ qual) _ symbol _ =

0 commit comments

Comments
 (0)