EventGhost/EventGhost

View on GitHub
eg/Classes/PythonEditorCtrl.py

Summary

Maintainability
D
2 days
Test Coverage

File PythonEditorCtrl.py has 341 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/PythonEditorCtrl.py - About 4 hrs to fix

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

        def __init__(
            self,
            parent,
            pos=wx.DefaultPosition,
            size=wx.DefaultSize,
    Severity: Major
    Found in eg/Classes/PythonEditorCtrl.py - About 3 hrs to fix

      Function Expand has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          def Expand(self, line, doExpand, force=False, visLevels=0, level=-1):
              lastChild = self.GetLastChild(line, level)
              line = line + 1
      
              while line <= lastChild:
      Severity: Minor
      Found in eg/Classes/PythonEditorCtrl.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 AutoIndent has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          def AutoIndent(self):
              indentSize = self.SetIndentSize(self.GetValue())
      
              pos = self.GetCurrentPos()
      
      
      Severity: Minor
      Found in eg/Classes/PythonEditorCtrl.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 OnMarginClick has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          def OnMarginClick(self, event):
              # fold and unfold as needed
              if event.GetMargin() == 2:
                  if event.GetShift() and event.GetControl():
                      self.FoldAll()
      Severity: Minor
      Found in eg/Classes/PythonEditorCtrl.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

      PythonEditorCtrl has 21 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class PythonEditorCtrl(StyledTextCtrl):
          def __init__(
              self,
              parent,
              pos=wx.DefaultPosition,
      Severity: Minor
      Found in eg/Classes/PythonEditorCtrl.py - About 2 hrs to fix

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

            def FoldAll(self):
                lineCount = self.GetLineCount()
                expanding = True
        
                # find out if we are folding or unfolding
        Severity: Minor
        Found in eg/Classes/PythonEditorCtrl.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 OnUpdateUI has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def OnUpdateUI(self, dummyEvent):
                # check for matching braces
                braceAtCaret = -1
                braceOpposite = -1
                charBefore = None
        Severity: Minor
        Found in eg/Classes/PythonEditorCtrl.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

        Avoid deeply nested control flow statements.
        Open

                                if self.GetFoldExpanded(lineClicked):
                                    self.SetFoldExpanded(lineClicked, False)
                                    self.Expand(lineClicked, False, True, 0)
                                else:
                                    self.SetFoldExpanded(lineClicked, True)
        Severity: Major
        Found in eg/Classes/PythonEditorCtrl.py - About 45 mins to fix

          Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __init__(
          Severity: Minor
          Found in eg/Classes/PythonEditorCtrl.py - About 35 mins to fix

            Function Expand has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def Expand(self, line, doExpand, force=False, visLevels=0, level=-1):
            Severity: Minor
            Found in eg/Classes/PythonEditorCtrl.py - About 35 mins to fix

              There are no issues that match your filters.

              Category
              Status