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)
Severity: Minor
Found in flaw-js/flaw.js - About 1 hr to fix

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');

Severity: Minor
Found in flaw-window/src/flaw-window.js - About 1 hr to fix

    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
    Severity: Minor
    Found in flaw-input/js/flaw-input.js - About 1 hr to fix

      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');
      
      
      Severity: Minor
      Found in flaw-window/src/flaw-window.js - About 1 hr to fix

      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
      Severity: Major
      Found in flaw-input/js/flaw-input.js - About 1 hr to fix

        Parse error
        Open

              , aut_steamid = SteamId . read . T.unpack -> steamId

        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.

        Use readTVarIO
        Open

                Just windowId -> fmap (HashMap.lookup windowId) $ atomically $ readTVar windowsVar
        Severity: Minor
        Found in flaw-window/Flaw/Window/Sdl.hs by hlint

        Found

        atomically $ readTVar windowsVar

        Perhaps

        readTVarIO windowsVar

        Parse error
        Open

              , SDL.controllerButtonEventButton = gamepadButtonFromSdlButton . fromIntegral -> button
        Severity: Minor
        Found in flaw-input/Flaw/Input/Sdl.hs by hlint

        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.

        Parse error
        Open

            { u_id = read . T.unpack -> userId

        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

            [ "ANGLE_instanced_arrays"
        Severity: Minor
        Found in flaw-gl/Flaw/Graphics/WebGL.hs by hlint

        Found

        -- enable extensions
            let extensions =
        >     [ "ANGLE_instanced_arrays"
              , "EXT_color_buffer_half_float"
              , "EXT_frag_depth"

        remove it.

        Parse error
        Open

            { canvasElement = jsCanvas
        Severity: Minor
        Found in flaw-window/Flaw/Window/Web/Canvas.hs by hlint

        Found

        eventsChan      { canvasElement = jsCanvas
              , canvasEventsChan = eventsChan
              }

        remove it.

        Parse error
        Open

                    { taskModules = map T.unpack -> modules
        Severity: Minor
        Found in flaw-script/Flaw/Script.hs by hlint

        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

        Found

        }    callback  do
              let bytes = case WME.getData $ unsafeCoerce messageEvent of
                WME.StringData s -> T.encodeUtf8 $ textFromJSString s

        remove it.

        Use readTVarIO
        Open

            exit <- atomically $ readTVar exitVar
        Severity: Minor
        Found in flaw-editor/exe/model-editor.hs by hlint

        Found

        atomically $ readTVar exitVar

        Perhaps

        readTVarIO exitVar

        Parse error
        Open

          , lockstepClientRenderDelay = realToFrac -> renderDelay
        Severity: Minor
        Found in flaw-game/Flaw/Game/Lockstep.hs by hlint

        Found

        lockstepClientRender LockstepClient
            { lockstepClientConfig = config
        >   , lockstepClientRenderDelay = realToFrac -> renderDelay
            , lockstepClientMinRenderDelay = realToFrac -> minRenderDelay
            , lockstepClientMaxRenderDelay = realToFrac -> maxRenderDelay

        remove it.

        Use readTVarIO
        Open

              exit <- atomically $ readTVar exitVar
        Severity: Minor
        Found in flaw-editor/exe/editor.hs by hlint

        Found

        atomically $ readTVar exitVar

        Perhaps

        readTVarIO exitVar

        Parse error
        Open

                    timedOut <- readTVar delayVar

        Found

        let step = join $ atomically $ do
                    let readPing = do
        >             timedOut 

        remove it.

        Eta reduce
        Open

        lerp a b c = LerpNode (nodeValueType a) a b c

        Found

        lerp a b c = LerpNode (nodeValueType a) a b c

        Perhaps

        lerp a = LerpNode (nodeValueType a) a

        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

        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"
        Severity
        Category
        Status
        Source
        Language