python-security/pyt

View on GitHub

Showing 120 of 158 total issues

Function connect_nodes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def connect_nodes(nodes):
    """Connect the nodes in a list linearly."""
    for n, next_node in zip(nodes, nodes[1:]):
        if isinstance(n, ControlFlowNode):
            _connect_control_flow_node(n, next_node)
Severity: Minor
Found in pyt/cfg/stmt_visitor_helper.py - About 35 mins 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 too many return statements within this function.
Open

        return IgnoredNode()
Severity: Major
Found in pyt/cfg/stmt_visitor.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                    return self.add_module(
    Severity: Major
    Found in pyt/cfg/stmt_visitor.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                      return self.append_node(AssignmentNode(
      Severity: Major
      Found in pyt/cfg/stmt_visitor.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return self.assign_multi_target(node, rhs_visitor.result)
        Severity: Major
        Found in pyt/cfg/stmt_visitor.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return VulnerabilityType.SANITISED, interactive
          Severity: Major
          Found in pyt/vulnerabilities/vulnerabilities.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                            return VulnerabilityType.UNKNOWN, interactive
            Severity: Major
            Found in pyt/vulnerabilities/vulnerabilities.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                              return self.assignment_call_node(label.result, node)
              Severity: Major
              Found in pyt/cfg/stmt_visitor.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return VulnerabilityType.TRUE, interactive
                Severity: Major
                Found in pyt/vulnerabilities/vulnerabilities.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return self.add_blackbox_or_builtin_call(node, blackbox=False)
                  Severity: Major
                  Found in pyt/cfg/expr_visitor.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return IgnoredNode()
                    Severity: Major
                    Found in pyt/cfg/stmt_visitor.py - About 30 mins to fix

                      Function restore_saved_local_scope has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def restore_saved_local_scope(
                              self,
                              saved_variables,
                              args_mapping,
                              line_number
                      Severity: Minor
                      Found in pyt/cfg/expr_visitor.py - About 25 mins 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 is_flask_route_function has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def is_flask_route_function(ast_node):
                          """Check whether function uses a route decorator."""
                          for decorator in ast_node.decorator_list:
                              if isinstance(decorator, ast.Call):
                                  if _get_last_of_iterable(get_call_names(decorator.func)) == 'route':
                      Severity: Minor
                      Found in pyt/web_frameworks/framework_helper.py - About 25 mins 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 return_connection_handler has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def return_connection_handler(nodes, exit_node):
                          """Connect all return statements to the Exit node."""
                          for function_body_node in nodes:
                              if isinstance(function_body_node, ConnectToExitNode):
                                  if exit_node not in function_body_node.outgoing:
                      Severity: Minor
                      Found in pyt/cfg/expr_visitor_helper.py - About 25 mins 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 save_local_scope has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def save_local_scope(
                              self,
                              line_number,
                              saved_function_call_index
                          ):
                      Severity: Minor
                      Found in pyt/cfg/expr_visitor.py - About 25 mins 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 _get_names has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def _get_names(node, result):
                          """Recursively finds all names."""
                          if isinstance(node, ast.Name):
                              return node.id + result
                          elif isinstance(node, ast.Subscript):
                      Severity: Minor
                      Found in pyt/cfg/stmt_visitor_helper.py - About 25 mins 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 report has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def report(
                          vulnerabilities,
                          fileobj,
                          print_sanitised,
                      ):
                      Severity: Minor
                      Found in pyt/formatters/text.py - About 25 mins 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 find_vulnerabilities_in_cfg has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def find_vulnerabilities_in_cfg(
                          cfg,
                          definitions,
                          lattice,
                          blackbox_mapping,
                      Severity: Minor
                      Found in pyt/vulnerabilities/vulnerabilities.py - About 25 mins 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 visit_Call has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def visit_Call(self, node):
                              if node.args:
                                  for arg in node.args:
                                      self.visit(arg)
                              if node.keywords:
                      Severity: Minor
                      Found in pyt/helper_visitors/right_hand_side_visitor.py - About 25 mins 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 fixpoint_runner has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def fixpoint_runner(self):
                              """Work list algorithm that runs the fixpoint algorithm."""
                              q = self.cfg.nodes
                      
                              while q != []:
                      Severity: Minor
                      Found in pyt/analysis/fixed_point.py - About 25 mins 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

                      Severity
                      Category
                      Status
                      Source
                      Language