EventGhost/EventGhost

View on GitHub
eg/Classes/TreeItem.py

Summary

Maintainability
D
2 days
Test Coverage

TreeItem has 40 functions (exceeds 20 allowed). Consider refactoring.
Open

class TreeItem(object):
    # name
    # parent
    # isEnabled
    # xmlId
Severity: Minor
Found in eg/Classes/TreeItem.py - About 5 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

      Function CanPaste has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def CanPaste(self):
              if not wx.TheClipboard.Open():
                  return False
              try:
                  dataObj = wx.CustomDataObject("DragEventItem")
      Severity: Minor
      Found in eg/Classes/TreeItem.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 GetDependantsOutside has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def GetDependantsOutside(self, allItems):
              result = []
              append = result.append
      
              def RecurseChilds(item):
      Severity: Minor
      Found in eg/Classes/TreeItem.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 AskDelete has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def AskDelete(self):
              allItems = self.GetAllItems()
              if eg.config.confirmDelete:
                  count = len(allItems) - 1
                  if count > 0:
      Severity: Minor
      Found in eg/Classes/TreeItem.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

      Avoid too many return statements within this function.
      Open

                              return False
      Severity: Major
      Found in eg/Classes/TreeItem.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                                return False
        Severity: Major
        Found in eg/Classes/TreeItem.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                          return False
          Severity: Major
          Found in eg/Classes/TreeItem.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return True
            Severity: Major
            Found in eg/Classes/TreeItem.py - About 30 mins to fix

              Function GetNextItem has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def GetNextItem(self):
                      """
                      Returns the next item in the tree.
              
                      This would be the next visible item of the tree if all items were
              Severity: Minor
              Found in eg/Classes/TreeItem.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

              There are no issues that match your filters.

              Category
              Status