EventGhost/EventGhost

View on GitHub
plugins/USB-UIRT/__init__.py

Summary

Maintainability
D
2 days
Test Coverage

File __init__.py has 557 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: Major
Found in plugins/USB-UIRT/__init__.py - About 1 day to fix

    Function Configure has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        def Configure(self, code='', repeatCount=None, inactivityWaitTime=None):
            text = self.text
            panel = eg.ConfigPanel()
            if repeatCount is None:
                repeatCount = self.repeatCount
    Severity: Minor
    Found in plugins/USB-UIRT/__init__.py - About 2 hrs 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 __init__ has 57 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def __init__(self, parent, dll, hDrvHandle, text):
            self.dll = dll
            self.hDrvHandle = hDrvHandle
            self.code = None
            self.codeFormat = UUIRTDRV_IRFMT_PRONTO
    Severity: Major
    Found in plugins/USB-UIRT/__init__.py - About 2 hrs to fix

      Function Configure has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def Configure(self, code='', repeatCount=None, inactivityWaitTime=None):
              text = self.text
              panel = eg.ConfigPanel()
              if repeatCount is None:
                  repeatCount = self.repeatCount
      Severity: Minor
      Found in plugins/USB-UIRT/__init__.py - About 1 hr to fix

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

            def __start__(
                self,
                ledRX=True,
                ledTX=True,
                legacyRX=False,
        Severity: Minor
        Found in plugins/USB-UIRT/__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 __call__ has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def __call__(self, code='', repeatCount=4, inactivityWaitTime=0):
                if not self.plugin.dll:
                    raise self.Exceptions.DeviceNotReady
                if len(code) > 5:
                    start = 0
        Severity: Minor
        Found in plugins/USB-UIRT/__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 OnDeviceRemoved has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def OnDeviceRemoved(self, event):
                if event.payload[0].split("#")[1] == 'Vid_0403&Pid_f850':
                    if self.dll:
                        if not self.dll.UUIRTClose(self.hDrvHandle):
                            raise self.Exception("Error calling UUIRTClose")
        Severity: Minor
        Found in plugins/USB-UIRT/__init__.py - About 25 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

        TODO found
        Open

                # TODO: find a more efficient way to find the terminator
        Severity: Minor
        Found in plugins/USB-UIRT/__init__.py by fixme

        There are no issues that match your filters.

        Category
        Status