EventGhost/EventGhost

View on GitHub
plugins/FS20PCS/__init__.py

Summary

Maintainability
C
1 day
Test Coverage

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

"""<rst>
Allows to send commands to FS20 receivers.

|

Severity: Minor
Found in plugins/FS20PCS/__init__.py - About 5 hrs to fix

    Function __init__ has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def __init__(self):
            self.version = None
            self.thread = None
    
            self.AddNewAction(self, "Off", SimpleAction, 0x00, "Off", "Turns device off (dim to 0%)", "Turn off {0}")
    Severity: Minor
    Found in plugins/FS20PCS/__init__.py - About 1 hr to fix

      Function RawCallback has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def RawCallback(self, data):
              if eg.debugLevel:
                  print "FS20PCS RawCallBack", binascii.hexlify(data)
      
              if len(data) != 5 or data[0:3] != "\x02\x03\xA0":
      Severity: Minor
      Found in plugins/FS20PCS/__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 GetStringFromAddress has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def GetStringFromAddress(address, formatted = False):
          valueStr = ""
          for i in range(11, -1, -1):
              x = (address >> i*2) & 0x03
              valueStr += str(x + 1)
      Severity: Minor
      Found in plugins/FS20PCS/__init__.py - About 55 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

      Function AddNewAction has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def AddNewAction(self, root, internalName, baseClass, classFuncCode, externalName, classDescription, classLabelFormat):
      Severity: Major
      Found in plugins/FS20PCS/__init__.py - About 50 mins to fix

        There are no issues that match your filters.

        Category
        Status