haskell-language-server/.hlint.yaml
Jan Hrcek 4985793137
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
2024-05-13 10:10:32 +01:00

237 lines
6.7 KiB
YAML

# HLint configuration file
# https://github.com/ndmitchell/hlint
##########################
# To run HLint do:
# $ hlint --git -j4
# Warnings currently triggered by our code
- ignore: {name: "Use <$>"}
- ignore: {name: "Use :"}
- ignore: {name: "Redundant do"}
- ignore: {name: "Avoid lambda"}
- ignore: {name: "Use newtype instead of data"}
- ignore: {name: "Use unless"}
- ignore: {name: "Move brackets to avoid $"}
- ignore: {name: "Eta reduce"}
- ignore: {name: "Parse error"}
- ignore: {name: "Reduce duplication"}
- ignore: {name: "Use ++"}
- ignore: {name: "Use $>"}
- ignore: {name: "Use section"}
- ignore: {name: "Use record patterns"}
- ignore: {name: "Use camelCase"}
- ignore: {name: "Use uncurry"}
- ignore: {name: "Avoid lambda using `infix`"}
- ignore: {name: "Replace case with fromMaybe"}
# Gives at least one suggestion we don't like.
- ignore: {name: "Use <=<"}
- ignore: {name: "Use zipFrom"}
- ignore: {name: "Use zipWithFrom"}
# We are using the "redundant" return/pure to assign a name. We do not want to
# delete it. In particular, this is not an improvement:
# Found:
# do options <- somethingComplicated
# pure options
# Perhaps:
# do somethingComplicated
- ignore: {name: "Redundant return"}
- ignore: {name: "Redundant pure"}
# Off by default hints we like
- warn: {name: Use module export list}
# Condemn nub and friends
- warn: {lhs: nub (sort x), rhs: Data.List.Extra.nubSort x}
- warn: {lhs: nub, rhs: Data.List.Extra.nubOrd}
- warn: {lhs: nubBy, rhs: Data.List.Extra.nubOrdBy}
- warn: {lhs: Data.List.Extra.nubOn, rhs: Data.List.Extra.nubOrdOn}
- functions:
# Things that are unsafe in Haskell base library
- name: unsafePerformIO
within:
- Development.IDE.Core.Shake
- Development.IDE.GHC.Util
- Development.IDE.Core.FileStore
- Development.IDE.Plugin.CodeAction.Util
- Development.IDE.Graph.Internal.Database
- Development.IDE.Graph.Internal.Paths
- Development.IDE.Graph.Internal.Profile
- Development.IDE.Graph.Internal.Key
- Ide.Types
- Test.Hls
- Test.Hls.Command
- AutoTupleSpec
- name: unsafeInterleaveIO
within:
- Development.IDE.LSP.LanguageServer
- {name: unsafeDupablePerformIO, within: []}
- name: unsafeCoerce
within:
- Ide.Plugin.Eval.Code
- Development.IDE.Core.Compile
- Development.IDE.Types.Shake
- Ide.Plugin.Properties
# Things that are a bit dangerous in the GHC API
- name: nameModule
within:
- Development.IDE.GHC.CoreFile
- Ide.Plugin.CallHierarchy.Internal
- Ide.Plugin.Rename
- Compat.HieBin
# Partial functions
# We need to check fucntions which
# are typically exported multiple ways under both names,
# see https://github.com/ndmitchell/hlint/issues/1389
- name: [Prelude.head, Data.List.head]
within:
- Main
- Experiments
- Development.Benchmark.Rules
- Development.IDE.Plugin.Completions
- Development.IDE.Plugin.CodeAction.ExactPrint
- Development.IDE.Spans.Documentation
- Development.IDE.Session
- Ide.Plugin.CallHierarchy.Internal
- Ide.Plugin.Eval.Code
- Ide.Plugin.Eval.Util
- Ide.Plugin.Class.ExactPrint
- TExpectedActual
- TRigidType
- TRigidType2
- RightToLeftFixities
- Typeclass
- CompletionTests #Previously part of GHCIDE Main tests
- DiagnosticTests #Previously part of GHCIDE Main tests
- FindDefinitionAndHoverTests #Previously part of GHCIDE Main tests
- TestUtils #Previously part of GHCIDE Main tests
- CodeLensTests #Previously part of GHCIDE Main tests
- name: [Prelude.tail, Data.List.tail]
within:
- Main
- Development.Benchmark.Rules
- Development.IDE.Plugin.CodeAction
- Development.IDE.Plugin.CodeAction.ExactPrint
- Development.IDE.Session
- UnificationSpec
- WatchedFileTests #Previously part of GHCIDE Main tests
- name: [Prelude.last, Data.List.last]
within:
- Main
- Development.IDE.Plugin.CodeAction
- Development.IDE.Plugin.CodeAction.ExactPrint
- Development.IDE.Spans.Common
- Development.IDE.Graph.Internal.Types
- Ide.PluginUtils
- Ide.Plugin.Eval.Parse.Comments
- Ide.Plugin.Eval.CodeLens
- FindDefinitionAndHoverTests #Previously part of GHCIDE Main tests
- name: [Prelude.init, Data.List.init]
within:
- Main
- Development.IDE.Spans.Common
- Ide.PluginUtils
- Development.Benchmark.Rules
- TErrorGivenPartialSignature
- IfaceTests #Previously part of GHCIDE Main tests
- THTests #Previously part of GHCIDE Main tests
- WatchedFileTests #Previously part of GHCIDE Main tests
- name: Data.List.foldl1'
within: []
- name: Data.List.foldr1'
within: []
- name: ["Prelude.!!", "Data.List.!!"]
within:
- Main
- Experiments
- FunctionalCodeAction
- Development.IDE.Plugin.CodeAction
- Development.IDE.Plugin.Completions.Logic
- Development.IDE.Spans.Documentation
- TErrorGivenPartialSignature
- InitializeResponseTests #Previously part of GHCIDE Main tests
- PositionMappingTests #Previously part of GHCIDE Main tests
- name: Data.Text.head
within:
- Development.IDE.Plugin.CodeAction
- Development.IDE.Plugin.Completions.Logic
- name: Data.Foldable.foldl1
within: []
- name: Data.Foldable.foldr1
within: []
- name: Data.Maybe.fromJust
within:
- Experiments
- Main
- Progress
- Development.IDE.Core.Compile
- Development.IDE.Core.Rules
- Development.IDE.Core.Shake
- Development.IDE.Test
- Development.IDE.Graph.Internal.Profile
- Development.IDE.Graph.Internal.Rules
- CodeLensTests #Previously part of GHCIDE Main tests
- name: "Data.Map.!"
within: []
- name: "Data.IntMap.!"
within: []
- name: "Data.Vector.!"
within: []
- name: "GHC.Arr.!"
within: []
# We do not want to use functions from the
# GHC driver. Instead use hls rules to construct
# an appropriate GHC session
- name: "load"
within: []
- name: "load'"
within: []
- name: "loadWithCache"
within: []
# Tracing functions
# We ban an explicit list rather than the
# Debug.Trace, because that module also
# includes the eventlog tracing functions,
# which are legitimate to use.
- name:
- Debug.Trace.trace
- Debug.Trace.traceId
- Debug.Trace.traceShow
- Debug.Trace.traceShowId
- Debug.Trace.traceStack
- Debug.Trace.traceIO
- Debug.Trace.traceM
- Debug.Trace.traceShowM
- Debug.Trace.putTraceMsg
within:
- Development.IDE.Core.Compile
- Development.IDE.Graph.Internal.Database
- Development.IDE.GHC.Util
- Development.IDE.Plugin.CodeAction.Util
# We really do not want novel usages of restricted functions, and mere
# Warning is not enough to prevent those consistently; you need a build failure.
- error: {name: Avoid restricted function}