Showing 25 of 31 total issues
Function generate
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def generate(self):
if self.node is None:
self.node = ast.parse(self.code)
if isinstance(self.node, ast.Module):
for x in self.node.body:
- 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 get_type
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def get_type(self, node):
if isinstance(node, ast.BinOp):
left_type = self.get_type(node.left)
right_type = self.get_type(node.right)
- 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 get_type
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def get_type(self, node):
if isinstance(node, ast.Num):
return Type.NUMBER
elif isinstance(node, ast.Str):
return Type.STRING
- 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 system_function
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def system_function(name, return_type, *arg_types):
def decorator(func):
global SYSTEM_FUNCTION_TABLE
def wrapper(generator, node):
func_args = [generator, ]
- 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 get_function_return_type
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def get_function_return_type(self, function_name, args_type=[]):
function = self.functions[function_name]
if is_system_function(function_name):
return SystemFunction.get_function(function_name).return_type
if function 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 _generate_binop
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _generate_binop(self, node, ext_info):
left_type = self.get_type(node.left)
right_type = self.get_type(node.right)
extra_code = ext_info.get('extra_code', '')
- 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 generate_call
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def generate_call(self, node, ext_info={}):
if hasattr(node, 'kwargs'):
if not node.kwargs is None:
raise SyntaxNotSupportError('Keyword arguments is not support yet.')
elif not len(node.keywords) == 0:
- 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 generate_name
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def generate_name(self, node, ext_info={'is_arg': False}):
is_arg = ext_info.get('is_arg', False)
if isinstance(node.ctx, ast.Store) or isinstance(node.ctx, ast.Param):
return 'export ' + node.id if self.is_global else 'local ' + node.id
else:
- 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 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function analysis
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def analysis(self):
for node in self.module_node.body:
if isinstance(node, ast.Assign):
self.analysis_assign_node(self.variables, node)
elif isinstance(node, ast.Expr):
- 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 execute_from_command_line
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def execute_from_command_line():
args = parser.parse_args()
try:
script = ''
- 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 analysis_function
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def analysis_function(self, function_node, args_type=[]):
variables = Variables()
return_type = Type.VOID
for node in function_node.body:
- 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 self.get_function_return_type(node.func.id, args_type)
Avoid too many return
statements within this function. Open
return self.variables[node.id].var_type
Avoid too many return
statements within this function. Open
return Type.VOID
Avoid too many return
statements within this function. Open
return 'Unknown'
Avoid too many return
statements within this function. Open
return Type.NUMBER
Avoid too many return
statements within this function. Open
return 'List'
Avoid too many return
statements within this function. Open
return self.functions[node.func.id].return_type
Avoid too many return
statements within this function. Open
return Type.STRING