Showing 83 of 158 total issues
Function assign_tuple_target
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def assign_tuple_target(self, target_nodes, value_nodes, right_hand_side_variables):
new_assignment_nodes = []
remaining_variables = list(right_hand_side_variables)
remaining_targets = list(target_nodes)
remaining_values = list(value_nodes) # May contain duplicates
- 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 build_def_use_chain
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def build_def_use_chain(
cfg_nodes,
lattice
):
def_use = defaultdict(list)
- 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 slicev
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def slicev(self, node):
if isinstance(node, ast.Slice):
if node.lower:
self.visit(node.lower)
if node.upper:
- 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 visit_Assign
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def visit_Assign(self, node):
rhs_visitor = RHSVisitor()
rhs_visitor.visit(node.value)
if isinstance(node.targets[0], (ast.Tuple, ast.List)): # x,y = [1,2]
if isinstance(node.value, (ast.Tuple, ast.List)):
- 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 slicev
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def slicev(self, node):
if isinstance(node, ast.Slice):
if node.lower:
self.visit(node.lower)
if node.upper:
- 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 visit_Call
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def visit_Call(self, node):
# This will not visit Flask in Flask(__name__) but it will visit request in `request.args.get()
if not isinstance(node.func, ast.Name):
self.visit(node.func)
for arg_node in itertools.chain(node.args, node.keywords):
- 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 visit_Call
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def visit_Call(self, node):
_id = get_call_names_as_string(node.func)
local_definitions = self.module_definitions_stack[-1]
alias = handle_aliases_in_calls(_id, local_definitions.import_alias_mapping)
- 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 visit_Try
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def visit_Try(self, node):
try_node = self.append_node(TryNode(
node,
path=self.filenames[-1]
))
- 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_sink_args_which_propagate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def get_sink_args_which_propagate(sink, ast_node):
sink_args_with_positions = CallVisitor.get_call_visit_results(sink.trigger.call, ast_node)
sink_args = []
kwargs_present = set()
- 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 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function add_module
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_module( # noqa: C901
Function __init__
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, label, left_hand_side, ast_node, right_hand_side_variables, *, line_number, path, func_name):
Function visit_curried_call_inside_call_args
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def visit_curried_call_inside_call_args(self, inner_call):
# Curried functions aren't supported really, but we now at least have a defined behaviour.
# In f(g(a)(b)(c)), inner_call is the Call node with argument c
# Try to get the name of curried function g
curried_func = inner_call.func.func
- 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 from_directory_import
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def from_directory_import(
self,
module,
real_names,
local_names,
- 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 find_vulnerabilities_in_cfg
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def find_vulnerabilities_in_cfg(
Function get_vulnerability
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_vulnerability(
Function __init__
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, label, left_hand_side, ast_node, right_hand_side_variables, *, line_number=None, path):
Function how_vulnerable
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def how_vulnerable(
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, label, left_hand_side, right_hand_side_variables, *, line_number, path):
Function generate_ast
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def generate_ast(path):
"""Generate an Abstract Syntax Tree using the ast module.
Args:
path(str): The path to the file e.g. example/foo/bar.py
- 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"