EventGhost/EventGhost

View on GitHub
eg/Classes/MainFrame/LogCtrl.py

Summary

Maintainability
C
1 day
Test Coverage

LogCtrl has 30 functions (exceeds 20 allowed). Consider refactoring.
Open

class LogCtrl(wx.ListCtrl):
    """
    Implementation of a ListCtrl with a circular buffer.
    """
    def __init__(self, parent):
Severity: Minor
Found in eg/Classes/MainFrame/LogCtrl.py - About 3 hrs to fix

    File LogCtrl.py has 276 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/MainFrame/LogCtrl.py - About 2 hrs to fix

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

          def __init__(self, parent):
              self.maxlength = 2000
              self.removeOnMax = 200
              self.indent = ""
              self.OnGetItemText = self.OnGetItemTextWithDT
      Severity: Minor
      Found in eg/Classes/MainFrame/LogCtrl.py - About 1 hr to fix

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

            def OnCmdCopy(self, dummyEvent=None):
                text = ""
                lines = 1
                firstItem = item = self.GetNextItem(
                    -1,
        Severity: Minor
        Found in eg/Classes/MainFrame/LogCtrl.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 OnCmdReplay has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def OnCmdReplay(self, dummyEvent=None):
                item = self.GetFirstSelected()
                while item != -1:
                    text, icon = self.GetItemData(item)[:2]
                    if icon == eg.Icons.EVENT_ICON:
        Severity: Minor
        Found in eg/Classes/MainFrame/LogCtrl.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 WriteLine has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def WriteLine(self, line, icon, wRef, when, indent):
        Severity: Minor
        Found in eg/Classes/MainFrame/LogCtrl.py - About 35 mins to fix

          Function SetDTLogging has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def SetDTLogging(self):
                  if self.logDates and self.logTimes:
                      self._datetime_fmt = " {0}  %X   ".format(eg.config.datestamp)
                  elif self.logDates:
                      self._datetime_fmt = " {0}   ".format(eg.config.datestamp)
          Severity: Minor
          Found in eg/Classes/MainFrame/LogCtrl.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

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

              def OnDoubleClick(self, event):
                  item, flags = self.HitTest(event.GetPosition())
                  if flags & wx.LIST_HITTEST_ONITEM:
                      icon, wref = self.GetItemData(item)[1:3]
                      if icon != eg.EventItem.icon and wref is not None:
          Severity: Minor
          Found in eg/Classes/MainFrame/LogCtrl.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