omar2535/GraphQLer

View on GitHub
graphqler/fuzzer/fuzzer.py

Summary

Maintainability
B
7 hrs
Test Coverage

Function __perform_dfs has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    def __perform_dfs(self, starter_stack: list[Node], filter_mutation_type: list[str]):
        """Performs DFS with the initial starter stack

        Args:
            starter_stack (list[Node]): A list of the nodes to start the fuzzing
Severity: Minor
Found in graphqler/fuzzer/fuzzer.py - About 3 hrs 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

File fuzzer.py has 260 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Class for fuzzer

1. Gets all nodes that can be run without a dependency (query/mutation)
2. Adds these to the DFS queue
3. 1st Pass: Perform DFS, going through only creation nodes
Severity: Minor
Found in graphqler/fuzzer/fuzzer.py - About 2 hrs to fix

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

        def __evaluate(self, node: Node, visit_path: list[Node], check_hard_depends_on: bool = True) -> tuple[list[list[Node]], Result]:
            """Evaluates the path, performing the following based on the type of node:
               Case 1: If it's an object node, then we should check if the object is in our bucket. If not, fail, if it is,
                       then queue up the next neighboring nodes to visit
               Case 2: If it's an query node or mutation node, run the payload with the required objects, then store the results in the object bucket
    Severity: Minor
    Found in graphqler/fuzzer/fuzzer.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

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

        def __fuzz(self, node: Node, visit_path: list[Node]):
            """Fuzzes a node by running the node and storing the results. Currently runs:
               - DOS Query / Mutation (from size 0 to MAX_INPUT_DEPTH or HARD_CUTOFF_DEPTH, whichever is smaller)
    
            Args:
    Severity: Minor
    Found in graphqler/fuzzer/fuzzer.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

    There are no issues that match your filters.

    Category
    Status