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

            { 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

              , 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.

        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

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

        Found

        eventsChan      { canvasElement = jsCanvas
              , canvasEventsChan = eventsChan
              }

        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

            [ "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

                    timedOut <- readTVar delayVar

        Found

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

        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.

        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.

        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

          callback <- asyncCallback1 $ \messageEvent -> do

        Found

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

        remove it.

        Eta reduce
        Open

        glBufferData_null target size usage = glBufferData target size nullPtr usage
        Severity: Minor
        Found in flaw-gl/Flaw/Graphics/OpenGL/FFI.hs by hlint

        Found

        glBufferData_null target size usage
          = glBufferData target size nullPtr usage

        Perhaps

        glBufferData_null target size = glBufferData target size nullPtr

        Eta reduce
        Open

        min_ a b = MinNode (nodeValueType a) a b

        Found

        min_ a b = MinNode (nodeValueType a) a b

        Perhaps

        min_ a = MinNode (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
        Severity
        Category
        Status
        Source
        Language