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/>
#
Function __init__
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
def __init__(
self,
parent,
pos=wx.DefaultPosition,
size=wx.DefaultSize,
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:
- Read upRead up
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()
- Read upRead up
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()
- Read upRead up
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,
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
- Read upRead up
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
- Read upRead up
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)
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function Expand
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def Expand(self, line, doExpand, force=False, visLevels=0, level=-1):