Showing 292 of 292 total issues

Eta reduce
Open

glBufferData_null target size usage = glBufferData_val target (pToJSVal size) usage
Severity: Minor
Found in flaw-gl/Flaw/Graphics/WebGL/FFI.hs by hlint

Found

glBufferData_null target size usage
  = glBufferData_val target (pToJSVal size) usage

Perhaps

glBufferData_null target size
  = glBufferData_val target (pToJSVal size)

Use when
Open

  if stage /= PixelStage then fail "depthTarget can be used only in pixel program"
  else return ()

Found

if stage /= PixelStage then
  fail "depthTarget can be used only in pixel program" else return ()

Perhaps

Control.Monad.when (stage /= PixelStage) $
  fail "depthTarget can be used only in pixel program"

Use when
Open

  if stage /= VertexStage then fail "attribute can only be defined in vertex program"
  else return ()

Found

if stage /= VertexStage then
  fail "attribute can only be defined in vertex program" else
  return ()

Perhaps

Control.Monad.when (stage /= VertexStage) $
  fail "attribute can only be defined in vertex program"

Use when
Open

  if stage /= EndStage then fail "wrong program: stage should be end"
  else return ()

Found

if stage /= EndStage then fail "wrong program: stage should be end"
  else return ()

Perhaps

when (stage /= EndStage) $
  fail "wrong program: stage should be end"

Eta reduce
Open

equal_ a b = EqualNode (nodeValueType a) a b

Found

equal_ a b = EqualNode (nodeValueType a) a b

Perhaps

equal_ a = EqualNode (nodeValueType a) a

Eta reduce
Open

lessEqual_ a b = LessEqualNode (nodeValueType a) a b

Found

lessEqual_ a b = LessEqualNode (nodeValueType a) a b

Perhaps

lessEqual_ a = LessEqualNode (nodeValueType a) a

Redundant return
Open

        OP_JMP -> LuaInst [i + sbx + 1] $ \[jmpInstCode] codeState -> do
          jmpInstStmts <- jmpInstCode codeState
          return jmpInstStmts
Severity: Minor
Found in flaw-lua/Flaw/Script/Lua/Chunk.hs by hlint

Found

do jmpInstStmts <- jmpInstCode codeState
   return jmpInstStmts

Perhaps

do jmpInstCode codeState

Use when
Open

                else if (flags .&. RI_MOUSE_RIGHT_BUTTON_UP) > 0 then
                  addMouseEvent $ MouseUpEvent RightMouseButton
                else return ()
Severity: Minor
Found in flaw-input/Flaw/Input/Win32.hs by hlint

Found

if (flags .&. RI_MOUSE_RIGHT_BUTTON_UP) > 0 then
  addMouseEvent $ MouseUpEvent RightMouseButton else return ()

Perhaps

when ((flags .&. RI_MOUSE_RIGHT_BUTTON_UP) > 0) $
  addMouseEvent $ MouseUpEvent RightMouseButton

Redundant do
Open

  withForeignPtr bytes $ \ptr -> do
    pokeElemOff (ptr `plusPtr` offset) i value

Found

do pokeElemOff (ptr `plusPtr` offset) i value

Perhaps

pokeElemOff (ptr `plusPtr` offset) i value

Use when
Open

  if stage /= PixelStage then fail "colorTarget can be used only in pixel program"
  else return ()

Found

if stage /= PixelStage then
  fail "colorTarget can be used only in pixel program" else return ()

Perhaps

Control.Monad.when (stage /= PixelStage) $
  fail "colorTarget can be used only in pixel program"

Eta reduce
Open

glBufferData_bs target bytes usage = glBufferData_val target (byteStringToJsDataView bytes) usage
Severity: Minor
Found in flaw-gl/Flaw/Graphics/WebGL/FFI.hs by hlint

Found

glBufferData_bs target bytes usage
  = glBufferData_val target (byteStringToJsDataView bytes) usage

Perhaps

glBufferData_bs target bytes
  = glBufferData_val target (byteStringToJsDataView bytes)

Redundant do
Open

      iteration z r = do
        -- if we got key-value pair
        if r == MDB_SUCCESS then do
          -- get key
          keyLength <- fromIntegral . ptrToIntPtr <$> peek keyBufPtr
Severity: Minor
Found in flaw-lmdb/Flaw/Data/Lmdb.hs by hlint

Found

do if r == MDB_SUCCESS then
     do keyLength <- fromIntegral . ptrToIntPtr <$> peek keyBufPtr
        keyPtr <- peekElemOff keyBufPtr 1
        key <- B.packCStringLen (keyPtr, keyLength)
        if B.isPrefixOf keyPrefix key then
          do valueLength <- fromIntegral . ptrToIntPtr <$> peek valueBufPtr
             valuePtr <- peekElemOff valueBufPtr 1
             value <- B.packCStringLen (valuePtr, valueLength)
             (continue, nz) <- step key value z
             if continue then
               iteration nz =<<
                 mdb_cursor_get cursorPtr keyBufPtr valueBufPtr MDB_NEXT
               else return nz
          else return z
     else if r == MDB_NOTFOUND then return z else lmdbThrowError r

Perhaps

if r == MDB_SUCCESS then
  do keyLength <- fromIntegral . ptrToIntPtr <$> peek keyBufPtr
     keyPtr <- peekElemOff keyBufPtr 1
     key <- B.packCStringLen (keyPtr, keyLength)
     if B.isPrefixOf keyPrefix key then
       do valueLength <- fromIntegral . ptrToIntPtr <$> peek valueBufPtr
          valuePtr <- peekElemOff valueBufPtr 1
          value <- B.packCStringLen (valuePtr, valueLength)
          (continue, nz) <- step key value z
          if continue then
            iteration nz =<<
              mdb_cursor_get cursorPtr keyBufPtr valueBufPtr MDB_NEXT
            else return nz
       else return z
  else if r == MDB_NOTFOUND then return z else lmdbThrowError r

Redundant do
Open

    funDecl variant = do
      funD (mkName $ variant ++ "__") [clause [] (normalB [| SwizzleNode (valueType (undefined :: $(varT v))) (valueType (undefined :: $(conT resultTypeName) $(varT v))) $(litE $ stringL variant) |]) []]

Found

do funD (mkName $ variant ++ "__")
     [clause []
        (normalB
           [|
             SwizzleNode (valueType (undefined :: $( varT v )))
               (valueType (undefined :: $( conT resultTypeName ) $( varT v )))
               $( litE $ stringL variant )
             |])
        []]

Perhaps

funD (mkName $ variant ++ "__")
  [clause []
     (normalB
        [|
          SwizzleNode (valueType (undefined :: $( varT v )))
            (valueType (undefined :: $( conT resultTypeName ) $( varT v )))
            $( litE $ stringL variant )
          |])
     []]

Redundant do
Open

        OP_VARARG -> LuaInst [nextInstId] $ \[nextInstCode] codeState -> do
          putRets (if b == 0 then Left a else Right [a .. (a + b - 2)]) [| return $(varE varargName) |] nextInstCode codeState
Severity: Minor
Found in flaw-lua/Flaw/Script/Lua/Chunk.hs by hlint

Found

do putRets (if b == 0 then Left a else Right [a .. (a + b - 2)])
     [| return $( varE varargName ) |]
     nextInstCode
     codeState

Perhaps

putRets (if b == 0 then Left a else Right [a .. (a + b - 2)])
  [| return $( varE varargName ) |]
  nextInstCode
  codeState

Redundant do
Open

  }) value = do
  withForeignPtr bytes $ \ptr -> do
    pokeByteOff ptr offset value

Found

do withForeignPtr bytes $ \ ptr -> do pokeByteOff ptr offset value

Perhaps

withForeignPtr bytes $ \ ptr -> do pokeByteOff ptr offset value

Use when
Open

                else if (flags .&. RI_MOUSE_LEFT_BUTTON_UP) > 0 then
                  addMouseEvent $ MouseUpEvent LeftMouseButton
                else return ()
Severity: Minor
Found in flaw-input/Flaw/Input/Win32.hs by hlint

Found

if (flags .&. RI_MOUSE_LEFT_BUTTON_UP) > 0 then
  addMouseEvent $ MouseUpEvent LeftMouseButton else return ()

Perhaps

when ((flags .&. RI_MOUSE_LEFT_BUTTON_UP) > 0) $
  addMouseEvent $ MouseUpEvent LeftMouseButton

Use when
Open

  if stage /= PixelStage then fail "dualColorTarget can be used only in pixel program"
  else return ()

Found

if stage /= PixelStage then
  fail "dualColorTarget can be used only in pixel program" else
  return ()

Perhaps

Control.Monad.when (stage /= PixelStage) $
  fail "dualColorTarget can be used only in pixel program"

Eta reduce
Open

less_ a b = LessNode (nodeValueType a) a b

Found

less_ a b = LessNode (nodeValueType a) a b

Perhaps

less_ a = LessNode (nodeValueType a) a

Use when
Open

  if stage == EndStage then fail "failed to add temp after end of the program"
  else return ()

Found

if stage == EndStage then
  fail "failed to add temp after end of the program" else return ()

Perhaps

Control.Monad.when (stage == EndStage) $
  fail "failed to add temp after end of the program"

Eta reduce
Open

if_ c a b = IfNode (nodeValueType a) c a b

Found

if_ c a b = IfNode (nodeValueType a) c a b

Perhaps

if_ c a = IfNode (nodeValueType a) c a
Severity
Category
Status
Source
Language