EventGhost/EventGhost

View on GitHub

Showing 1,842 of 2,440 total issues

Function do_GET has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    def do_GET(self):
        """Serve a GET request."""
        self.clAddr = self.getClientAddress()
        if self.plugin.noAutWs:
            # First test, if WebSocket connection
Severity: Minor
Found in plugins/Webserver/__init__.py - About 4 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

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

#
# DenonSerial V0.5
# ================
# Written by Oliver Wagner, <owagner@hometheatersoftware.com>
# Public Domain
Severity: Minor
Found in plugins/DenonSerial/__init__.py - About 4 hrs to fix

    File TreeItem.py has 356 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    #
    # This file is part of EventGhost.
    # Copyright © 2005-2020 EventGhost Project <http://www.eventghost.net/>
    #
    Severity: Minor
    Found in eg/Classes/TreeItem.py - About 4 hrs to fix

      Webserver has 35 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Webserver(eg.PluginBase):
      
          server = None
          wsClients = {}
          wsClientsTime = {}
      Severity: Minor
      Found in plugins/Webserver/__init__.py - About 4 hrs to fix

        Cyclomatic complexity is too high in method __call__. (37)
        Open

        
            def __call__(
                self,
                rangeName,
                iOffset,
        Severity: Minor
        Found in plugins/SunTracker/__init__.py by radon

        Cyclomatic Complexity

        Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

        Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

        Construct Effect on CC Reasoning
        if +1 An if statement is a single decision.
        elif +1 The elif statement adds another decision.
        else +0 The else statement does not cause a new decision. The decision is at the if.
        for +1 There is a decision at the start of the loop.
        while +1 There is a decision at the while statement.
        except +1 Each except branch adds a new conditional path of execution.
        finally +0 The finally block is unconditionally executed.
        with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
        assert +1 The assert statement internally roughly equals a conditional statement.
        Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
        Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

        Source: http://radon.readthedocs.org/en/latest/intro.html

        Cyclomatic complexity is too high in method __init__. (37)
        Open

        
            def __init__(
                self,
                error,
                imageFile,
        Severity: Minor
        Found in plugins/System/__init__.py by radon

        Cyclomatic Complexity

        Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

        Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

        Construct Effect on CC Reasoning
        if +1 An if statement is a single decision.
        elif +1 The elif statement adds another decision.
        else +0 The else statement does not cause a new decision. The decision is at the if.
        for +1 There is a decision at the start of the loop.
        while +1 There is a decision at the while statement.
        except +1 Each except branch adds a new conditional path of execution.
        finally +0 The finally block is unconditionally executed.
        with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
        assert +1 The assert statement internally roughly equals a conditional statement.
        Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
        Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

        Source: http://radon.readthedocs.org/en/latest/intro.html

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

        #
        # JVC DLA Serial Control
        # ======================
        #
        # This plug in is for controlling the following JVC HD-1 projector via RS-232
        Severity: Minor
        Found in plugins/JvcDlaSerial/__init__.py - About 4 hrs to fix

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

              def Configure(
                  self,
                  fore = (75, 75, 75),
                  back = (180, 180, 180),
                  fontInfo = TAHOMA_INFO,
          Severity: Major
          Found in plugins/RadioSure/__init__.py - About 4 hrs to fix

            Function DoTask has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
            Open

                def DoTask(self):
                    if not self.buildSetup.gitConfig["token"]:
                        print "WARNING: Skipping changelog build due to invalid token."
                        return
            
            
            Severity: Minor
            Found in _build/builder/BuildChangelog.py - About 4 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 xmlToData has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
            Open

                def xmlToData(self):
                    data = []
                    xmlfile = self.xmlpath
                    xmldoc = miniDom.parse(xmlfile)
                    document = xmldoc.getElementsByTagName('Document')[0]
            Severity: Minor
            Found in plugins/SchedulGhost/__init__.py - About 4 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 Configure has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
            Open

                def Configure(
                    self,
                    imageFile = '',
                    winSize = 0,
                    fitMode = 1,
            Severity: Minor
            Found in plugins/System/__init__.py - About 4 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 CompileString has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
            Open

            def CompileString(pattern):
                if pattern is None:
                    return None
                res = []
                startPos = 0
            Severity: Minor
            Found in eg/Classes/WindowMatcher.py - About 4 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 OnDragOver has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
            Open

                def OnDragOver(self, x, y, dummyDragResult):
                    """
                    Called when the mouse is being dragged over the drop target.
                    """
                    tree = self.treeCtrl
            Severity: Minor
            Found in eg/Classes/MainFrame/TreeCtrl.py - About 4 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

            File Execute.py has 350 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            # -*- coding: utf-8 -*-
            #
            # This file is part of EventGhost.
            # Copyright © 2005-2020 EventGhost Project <http://www.eventghost.net/>
            #
            Severity: Minor
            Found in plugins/System/Execute.py - About 4 hrs to fix

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

                  def Configure(
                      self,
                      plName="",
                      mode=0,
                      listRules=[[-1,-1,u""]],
              Severity: Major
              Found in plugins/MediaMonkey/__init__.py - About 4 hrs to fix

                Function __call__ has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                Open

                  def __call__(self):
                        responce = self.plugin.JSON_RPC.send('Player.GetActivePlayers')
                        if (responce != None):
                            Method = None
                            if (responce['result']['picture']): Method = 'Picture'
                Severity: Minor
                Found in plugins/XBMCRepeat/__init__.py - About 4 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 Callback has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                Open

                    def Callback(self, code):
                        if code[0] & 0x88:
                            buttonType, x, y, dummy = code
                            leftDown = buttonType & 0x01
                            if leftDown != self.leftDown:
                Severity: Minor
                Found in plugins/AsusPsr2000/__init__.py - About 4 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 Configure has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                Open

                    def Configure(  self,
                                 channelID   = "",
                                 date        = "",     # dd.mm.yyyy
                                 startTime   = "",     # hh:mm
                                 endTime     = "",     # hh:mm
                Severity: Minor
                Found in plugins/DVBViewer/__init__.py - About 4 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 UpdateDVTimers has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                Open

                    def UpdateDVTimers( self, lock=True, updateService=False ) :
                
                        timerIDs = []
                        completeTimerInfo = []
                
                
                Severity: Minor
                Found in plugins/DVBViewer/__init__.py - About 4 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 __call__ has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                Open

                    def __call__(self, step = None):
                        if step is None:
                            if self.value == 0:
                                step = 50
                            else:
                Severity: Minor
                Found in plugins/RadioSure/__init__.py - About 4 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

                Severity
                Category
                Status
                Source
                Language