python-security/pyt

View on GitHub

Showing 83 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

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

def _get_inner_most_function_call(call_node):
    # Loop to inner most function call
    # e.g. return scrypt.inner in `foo = scrypt.outer(scrypt.inner(image_name))`
    old_call_node = None
    while call_node != old_call_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

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

def report(
    vulnerabilities,
    fileobj,
    print_sanitised,
):
Severity: Minor
Found in pyt/formatters/screen.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

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

    def __str__(self):
        module = 'NoModuleName'
        if self.module_name:
            module = self.module_name

Severity: Minor
Found in pyt/core/module_definitions.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 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.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 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 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.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 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_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 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.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 VulnerabilityType.SANITISED, interactive
                    Severity: Major
                    Found in pyt/vulnerabilities/vulnerabilities.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 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 _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 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

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language