Showing 292 of 292 total issues
Function h$flaw_js_vendor_fixup_addEventListener
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
function h$flaw_js_vendor_fixup_addEventListener(object, event, listener, options) {
object.addEventListener((("on" + event) in object) ? event
: (("onwebkit" + event) in object) ? ("webkit" + event)
: (("onmoz" + event) in object) ? ("moz" + event)
: (("ono" + event) in object) ? ("o" + event)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function h$flaw_window_init_canvas
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
function h$flaw_window_init_canvas() {
// create canvas
var canvas = document.createElement('canvas');
Function h$flaw_input_register_events
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function h$flaw_input_register_events(canvas
, keydownCallback
, keyupCallback
, keypressCallback
, mousedownCallback
Function h$flaw_window_init_canvas
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function h$flaw_window_init_canvas() {
// create canvas
var canvas = document.createElement('canvas');
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function h$flaw_input_register_events
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
function h$flaw_input_register_events(canvas
, keydownCallback
, keyupCallback
, keypressCallback
, mousedownCallback
Parse error Open
[ "ANGLE_instanced_arrays"
- Read upRead up
- Exclude checks
Found
-- enable extensions
let extensions =
> [ "ANGLE_instanced_arrays"
, "EXT_color_buffer_half_float"
, "EXT_frag_depth"
remove it.
Parse error Open
, aut_steamid = SteamId . read . T.unpack -> steamId
- Read upRead up
- Exclude checks
Found
(J.fromJSON -> J.Success AuthenticatedUserTicket
{ aut_result = "OK"
> , aut_steamid = SteamId . read . T.unpack -> steamId
, aut_ownersteamid = SteamId . read . T.unpack -> ownerSteamId
, aut_vacbanned = vacBanned
remove it.
Parse error Open
{ u_id = read . T.unpack -> userId
- Read upRead up
- Exclude checks
Found
]
A.Object (HM.lookup "response" -> Just (A.Object (HM.lookup "users" -> Just (A.fromJSON -> A.Success [User
> { u_id = read . T.unpack -> userId
, u_username = userName1
, u_avatar_url = userAvatarUrl
remove it.
Parse error Open
{ canvasElement = jsCanvas
- Read upRead up
- Exclude checks
Found
eventsChan <- newBroadcastTChanIO
let canvas = Canvas
> { canvasElement = jsCanvas
, canvasEventsChan = eventsChan
}
remove it.
Parse error Open
, SDL.controllerButtonEventButton = gamepadButtonFromSdlButton . fromIntegral -> button
- Read upRead up
- Exclude checks
Found
{ SDL.eventType = eventType
, SDL.controllerButtonEventWhich = joystickId
> , SDL.controllerButtonEventButton = gamepadButtonFromSdlButton . fromIntegral -> button
} -> when (button /= GamepadButtonUnknown) $ case eventType of
SDL.SDL_CONTROLLERBUTTONDOWN -> addGamepadEvent joystickId $ GamepadButtonDownEvent button
remove it.
Use readTVarIO Open
Just windowId -> fmap (HashMap.lookup windowId) $ atomically $ readTVar windowsVar
- Read upRead up
- Exclude checks
Found
atomically $ readTVar windowsVar
Perhaps
readTVarIO windowsVar
Use readTVarIO Open
exit <- atomically $ readTVar exitVar
- Read upRead up
- Exclude checks
Found
atomically $ readTVar exitVar
Perhaps
readTVarIO exitVar
Use readTVarIO Open
exit <- atomically $ readTVar exitVar
- Read upRead up
- Exclude checks
Found
atomically $ readTVar exitVar
Perhaps
readTVarIO exitVar
Parse error Open
timedOut <- readTVar delayVar
- Read upRead up
- Exclude checks
Found
let step = join $ atomically $ do
let readPing = do
> timedOut <- readTVar delayVar
unless timedOut retry
return $ WS.sendPing connection B.empty
remove it.
Parse error Open
{ taskModules = map T.unpack -> modules
- Read upRead up
- Exclude checks
Found
-- if there's task
Just Task
> { taskModules = map T.unpack -> modules
, taskExpression = T.unpack -> expression
, taskResultVar = resultVar
remove it.
Parse error Open
callback <- asyncCallback1 $ \messageEvent -> do
- Read upRead up
- Exclude checks
Found
} <- atomically $ newBiuoSocket 1
> callback <- asyncCallback1 $ \messageEvent -> do
let bytes = case WME.getData $ unsafeCoerce messageEvent of
WME.StringData s -> T.encodeUtf8 $ textFromJSString s
remove it.
Parse error Open
, lockstepClientRenderDelay = realToFrac -> renderDelay
- Read upRead up
- Exclude checks
Found
lockstepClientRender LockstepClient
{ lockstepClientConfig = config
> , lockstepClientRenderDelay = realToFrac -> renderDelay
, lockstepClientMinRenderDelay = realToFrac -> minRenderDelay
, lockstepClientMaxRenderDelay = realToFrac -> maxRenderDelay
remove it.
Redundant do Open
withForeignPtr bytes $ \ptr -> do
pokeByteOff ptr offset value
- Read upRead up
- Exclude checks
Found
do pokeByteOff ptr offset value
Perhaps
pokeByteOff ptr offset value
Eta reduce Open
lerp a b c = LerpNode (nodeValueType a) a b c
- Read upRead up
- Exclude checks
Found
lerp a b c = LerpNode (nodeValueType a) a b c
Perhaps
lerp a = LerpNode (nodeValueType a) a
Unused LANGUAGE pragma Open
{-# LANGUAGE FlexibleInstances, JavaScriptFFI, TypeSynonymInstances #-}
- Read upRead up
- Exclude checks
Found
{-# LANGUAGE FlexibleInstances, JavaScriptFFI, TypeSynonymInstances
#-}
Perhaps
{-# LANGUAGE FlexibleInstances, JavaScriptFFI #-}
Applying this change:
- Extension TypeSynonymInstances is implied by FlexibleInstances