python-security/pyt

View on GitHub

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
Severity: Minor
Found in pyt/cfg/stmt_visitor.py - About 1 hr 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 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)
Severity: Minor
Found in pyt/analysis/definition_chains.py - About 1 hr 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 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:
Severity: Minor
Found in pyt/helper_visitors/vars_visitor.py - About 1 hr 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 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:
Severity: Minor
Found in pyt/helper_visitors/label_visitor.py - About 1 hr 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_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)):
Severity: Minor
Found in pyt/cfg/stmt_visitor.py - About 1 hr 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 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):
Severity: Minor
Found in pyt/helper_visitors/vars_visitor.py - About 1 hr 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 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)
Severity: Minor
Found in pyt/cfg/expr_visitor.py - About 1 hr 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_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]
        ))
Severity: Minor
Found in pyt/cfg/stmt_visitor.py - About 1 hr 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_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()

Severity: Minor
Found in pyt/vulnerabilities/vulnerabilities.py - About 1 hr 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 __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(
Severity: Major
Found in pyt/core/node_types.py - About 1 hr to fix

    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):
    Severity: Major
    Found in pyt/core/node_types.py - About 1 hr to fix

      Function add_module has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def add_module(  # noqa: C901
      Severity: Major
      Found in pyt/cfg/stmt_visitor.py - About 1 hr to fix

        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,
        Severity: Minor
        Found in pyt/cfg/stmt_visitor.py - About 55 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_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
        Severity: Minor
        Found in pyt/helper_visitors/vars_visitor.py - About 55 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 __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):
        Severity: Major
        Found in pyt/core/node_types.py - About 50 mins to fix

          Function how_vulnerable has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def how_vulnerable(
          Severity: Major
          Found in pyt/vulnerabilities/vulnerabilities.py - About 50 mins to fix

            Function get_vulnerability has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def get_vulnerability(
            Severity: Major
            Found in pyt/vulnerabilities/vulnerabilities.py - About 50 mins to fix

              Function find_vulnerabilities_in_cfg has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def find_vulnerabilities_in_cfg(
              Severity: Major
              Found in pyt/vulnerabilities/vulnerabilities.py - About 50 mins to fix

                Function make_cfg has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def make_cfg(
                Severity: Minor
                Found in pyt/cfg/make_cfg.py - About 45 mins to fix

                  Function append_if_local_or_in_imports has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def append_if_local_or_in_imports(self, definition):
                          """Add definition to list.
                  
                          Handles local definitions and adds to project_definitions.
                          """
                  Severity: Minor
                  Found in pyt/core/module_definitions.py - About 45 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