EventGhost/EventGhost

View on GitHub
plugins/RawInput/__init__.py

Summary

Maintainability
B
5 hrs
Test Coverage

File __init__.py has 265 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
#
# This file is a plugin for EventGhost.
# Copyright © 2005-2020 EventGhost Project <http://www.eventghost.net/>
#
Severity: Minor
Found in plugins/RawInput/__init__.py - About 2 hrs to fix

    Function OnCopyData has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def OnCopyData(self, hwnd, mesg, wParam, lParam):
            copyData = cast(lParam, PCOPYDATASTRUCT)
            hEvent = cast(copyData.contents.lpData, POINTER(HEVENT))
            if not (
                copyData.contents.dwData == 0
    Severity: Minor
    Found in plugins/RawInput/__init__.py - 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 ScanDevices has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def ScanDevices(self):
            nDevices = UINT(0)
            if -1 == GetRawInputDeviceList(
                None,
                byref(nDevices),
    Severity: Minor
    Found in plugins/RawInput/__init__.py - 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 OnRawInput has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def OnRawInput(self, hwnd, mesg, wParam, lParam):
            pcbSize = UINT()
            GetRawInputData(
                lParam, RID_INPUT, None, byref(pcbSize), sizeof(RAWINPUTHEADER)
            )
    Severity: Minor
    Found in plugins/RawInput/__init__.py - About 35 mins 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

    There are no issues that match your filters.

    Category
    Status