Skip to content

Hlint more partial functions, and Debug.Trace #3000

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 87 additions & 3 deletions .hlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,32 @@
- Compat.HieBin

# Partial functions

# For some reason 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
within:
- Main
- Development.Benchmark.Rules
- Development.IDE.Plugin.CodeAction
- Development.IDE.Plugin.Completions
- Development.IDE.Plugin.CodeAction.ExactPrint
- Development.IDE.Spans.Documentation
- Ide.Plugin.CallHierarchy.Internal
- Ide.Plugin.Eval.Code
- Ide.Plugin.Eval.Util
- Ide.Plugin.Floskell
- Ide.Plugin.ModuleName
- Ide.Plugin.Rename
- Ide.Plugin.Class.ExactPrint
- TExpectedActual
- TRigidType
- RightToLeftFixities
- Typeclass
- Wingman.Judgements
- Wingman.Machinery

- name: Data.List.head
within:
- Main
Expand All @@ -94,11 +120,18 @@
- Development.IDE.Session
- Development.IDE.Spans.Documentation
- Ide.Plugin.CallHierarchy.Internal
- TExpectedActual
- TRigidType
- TRigidType
- Ide.Plugin.Class
- Wingman.Tactics
- TExpectedActual
- TRigidType

- name: Prelude.tail
within:
- Main
- Development.Benchmark.Rules
- Development.IDE.Plugin.CodeAction
- Development.IDE.Plugin.CodeAction.ExactPrint
- UnificationSpec

- name: Data.List.tail
within:
Expand All @@ -111,11 +144,31 @@
- IDE.Plugin.Eval.Util
- UnificationSpec

- name: Prelude.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

- name: Data.List.last
within:
- GenChangelogs
- Main

- name: Prelude.init
within:
- Main
- Development.IDE.Spans.Common
- Ide.PluginUtils
- Wingman.Metaprogramming.Parser
- Development.Benchmark.Rules
- ErrorGivenPartialSignature

- name: Data.List.init
within: []

Expand All @@ -125,6 +178,16 @@
- name: Data.List.foldr1'
within: []

- name: "Prelude.!!"
within:
- Main
- Development.IDE.Plugin.CodeAction
- Development.IDE.Plugin.Completions.Logic
- Development.IDE.Spans.Documentation
- TErrorGivenPartialSignature
- Wingman.CaseSplit
- Wingman.Simplify

- name: "Data.List.!!"
within:
- Main
Expand Down Expand Up @@ -178,6 +241,27 @@
- name: "GHC.Arr.!"
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
- Wingman.Debug

# 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}
1 change: 0 additions & 1 deletion plugins/hls-alternate-number-format-plugin/test/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import Data.Either (rights)
import Data.List (find)
import Data.Text (Text)
import qualified Data.Text as T
import Debug.Trace
import qualified Ide.Plugin.AlternateNumberFormat as AlternateNumberFormat
import qualified Ide.Plugin.Conversion as Conversion
import Language.LSP.Types (toEither)
Expand Down