packages feed

hlint-3.2.4: tests/hint.test

---------------------------------------------------------------------
RUN tests/newtype-derive.hs --hint=data/hlint.yaml
FILE tests/newtype-derive.hs
{-# LANGUAGE DeriveTraversable #-} -- Implies DeriveFoldable and DeriveFunctor
{-# LANGUAGE DeriveDataTypeable #-}
module Test(A) where

import Data.Foldable (Foldable)
import Data.Traversable (Traversable)
import Data.Typeable (Typeable)

newtype A f = A f
  deriving (Foldable, Functor, Traversable, Typeable)
OUTPUT
No hints

---------------------------------------------------------------------
RUN tests/note.hs
FILE tests/note.hs
{-# LANGUAGE RecordWildCards #-}

module Sample(test) where

test xs = length xs == 0
OUTPUT
tests/note.hs:1:1-32: Warning: Unused LANGUAGE pragma
Found:
  {-# LANGUAGE RecordWildCards #-}
Perhaps you should remove it.
Note: may require `{-# LANGUAGE DisambiguateRecordFields #-}` adding to the top of the file

tests/note.hs:5:11-24: Suggestion: Use null
Found:
  length xs == 0
Perhaps:
  null xs
Note: increases laziness

2 hints

---------------------------------------------------------------------
RUN tests/brackets.hs
FILE tests/brackets.hs
test = if isNothing x then (-1.0) else fromJust x
OUTPUT
tests/brackets.hs:1:8-49: Warning: Use fromMaybe
Found:
  if isNothing x then (- 1.0) else fromJust x
Perhaps:
  fromMaybe (- 1.0) x

1 hint

---------------------------------------------------------------------
RUN tests/typesig-ignore.hs
FILE tests/typesig-ignore.hs
-- Bug #563
module Foo(foobar) where
{-# ANN foobar "HLint: ignore Use String" #-}

foobar :: [Char]
foobar = []
OUTPUT
No hints

---------------------------------------------------------------------
RUN tests/typesig-ignore2.hs
FILE tests/typesig-ignore2.hs
-- Bug #563
module Foo(foobar) where
{-# HLINT ignore foobar "Use String" #-}

foobar :: [Char]
foobar = []
OUTPUT
No hints

---------------------------------------------------------------------
RUN tests/restricted-module.lhs --hint=data/test-restrict.yaml
FILE tests/restricted-module.lhs
> import Restricted.Module
OUTPUT
tests/restricted-module.lhs:1:3-26: Warning: Avoid restricted module
Found:
  import Restricted.Module
Note: may break the code

1 hint

---------------------------------------------------------------------
RUN tests/restricted-module-message.lhs --hint=data/test-restrict.yaml
FILE tests/restricted-module-message.lhs
> import Restricted.Module.Message
OUTPUT
tests/restricted-module-message.lhs:1:3-34: Warning: Avoid restricted module
Found:
  import Restricted.Module.Message
Note: Custom message

1 hint

---------------------------------------------------------------------
RUN tests/restricted-function.lhs --hint=data/test-restrict.yaml
FILE tests/restricted-function.lhs
> main = restricted ()
OUTPUT
tests/restricted-function.lhs:1:10-19: Warning: Avoid restricted function
Found:
  restricted
Note: may break the code

1 hint

---------------------------------------------------------------------
RUN tests/restricted-function-message.lhs --hint=data/test-restrict.yaml
FILE tests/restricted-function-message.lhs
> main = restrictedMessage ()
OUTPUT
tests/restricted-function-message.lhs:1:10-26: Warning: Avoid restricted function
Found:
  restrictedMessage
Note: Custom message

1 hint

---------------------------------------------------------------------
RUN tests/restricted-extension.hs --hint=data/test-restrict.yaml
FILE tests/restricted-extension.hs
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE DeriveDataTypeable #-}
module Test(A) where

import Data.Foldable (Foldable)
import Data.Traversable (Traversable)
import Data.Typeable (Typeable)

newtype A f = A f
  deriving (Foldable, Functor, Traversable, Typeable)
OUTPUT
OUTPUT
tests/restricted-extension.hs:1:1-31: Warning: Unused LANGUAGE pragma
Found:
  {-# LANGUAGE DeriveFoldable #-}
Perhaps you should remove it.
Note: Extension DeriveFoldable is implied by DeriveTraversable

tests/restricted-extension.hs:2:1-30: Warning: Unused LANGUAGE pragma
Found:
  {-# LANGUAGE DeriveFunctor #-}
Perhaps you should remove it.
Note: Extension DeriveFunctor is implied by DeriveTraversable

tests/restricted-extension.hs:2:1-30: Warning: Avoid restricted extensions
Found:
  {-# LANGUAGE DeriveFunctor #-}
Note: may break the code

tests/restricted-extension.hs:3:1-34: Warning: Avoid restricted extensions
Found:
  {-# LANGUAGE DeriveTraversable #-}
Note: Custom message

4 hints