File Components.py
has 670 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
# Components.py ---
# --------------------------------
Function OnEditor
has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring. Open
def OnEditor(self, event):
""" Method that edit the python code of associated devs model of the Block.
"""
from Container import ShapeCanvas
- 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 CreateBlock
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def CreateBlock(*argv, **kwargs):
""" Create Block from python_file and other info coming from wizard.
"""
from Container import iPort, oPort, MsgBoxError
- 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 GetModule
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def GetModule(filename):
""" Give module object from python file path. Warning, the name of python_file must be the same of the classe name.
"""
dir_name = os.path.dirname(filename)
- 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 GetArgs
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def GetArgs(cls = None):
""" Get behavioral attribute from python file through constructor class.
"""
if inspect.isclass(cls):
- 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
DEVSComponent
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class DEVSComponent:
"""
"""
def __init__(self):
Function Rename
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def Rename(filename:str, new_name:str)->bool:
""" Rename the filename with the new_name.
"""
old_bn = os.path.basename(filename)
- 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 Load
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def Load(filename, label, canvas):
""" Load component from filename.
"""
from Container import Diagram
#assert(filename.endswith('.dsp'))
- 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 GetClass
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def GetClass(elem):
""" Get python class from filename.
"""
clsmembers = getClassMember(elem)
- 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 setBlock
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def setBlock(self, devs):
"""
Set the Block.
"""
if devs is not 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
Function Load
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def Load(filename, label):
""" Load CMD from filename.
"""
from Container import ContainerBlock, iPort, oPort
assert(filename.endswith('.cmd'))
- 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 BlockModelAdapter
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def BlockModelAdapter(cls, label="", specific_behavior=""):
""" Return block model considering its class hierarchy
The implementation depends only of the argument of the class. There is no dependance with the collector module (in comment bellow)
"""
from Container import DiskGUI, ScopeGUI, CodeBlock
- 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 __init__
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, *argv, **kwargs):
""" Constructor.
"""
# local copy
self._canvas = kwargs['canvas'] if 'id' in kwargs else 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 too many return
statements within this function. Open
return False
Avoid too many return
statements within this function. Open
return None
Function ChekFilename
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def ChekFilename(filename, model):
""" static method to correct the error occurring when the filename is not corresponding with values of paths
(model and python) embedded in the .amd (dat file). This error occurs when the user copy and past a .amd model into
an another directory.
"""
- 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"