python-security/pyt

View on GitHub

Showing 158 of 158 total issues

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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          def visit_Break(self, node):
              return self.append_node(BreakNode(
                  node,
                  path=self.filenames[-1]
      Severity: Minor
      Found in pyt/cfg/stmt_visitor.py and 1 other location - About 30 mins to fix
      pyt/cfg/stmt_visitor.py on lines 244..247

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 32.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            def visit_Raise(self, node):
                return self.append_node(RaiseNode(
                    node,
                    path=self.filenames[-1]
        Severity: Minor
        Found in pyt/cfg/stmt_visitor.py and 1 other location - About 30 mins to fix
        pyt/cfg/stmt_visitor.py on lines 733..736

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 32.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        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.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

              TODO found
              Open

              `project_handler.py`_  contains TODO
              Severity: Minor
              Found in pyt/core/README.rst by fixme
              Severity
              Category
              Status
              Source
              Language