omar2535/GraphQLer

View on GitHub
graphqler/utils/objects_bucket.py

Summary

Maintainability
A
3 hrs
Test Coverage

ObjectsBucket has 21 functions (exceeds 20 allowed). Consider refactoring.
Open

class ObjectsBucket:
    def __init__(self, api: API):
        self.api = api

        # Stores {object_name: {type: str, results: dict}} where list is a result with the scalar fields of the object
Severity: Minor
Found in graphqler/utils/objects_bucket.py - About 2 hrs to fix

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

        def find_key_in_dict(self, dictionary: dict, key: str) -> tuple[str, str | int | float | bool | None]:
            """Recursively searches for the key in a nested dictionary and returns its full path and value.
    
            Args:
                dictionary (dict): The dictionary to search
    Severity: Minor
    Found in graphqler/utils/objects_bucket.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 parse_as_scalar has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def parse_as_scalar(self, method_name: str, method_data: dict | list | str | int | float | bool | None):
            """Parses the data as a scalar (can be a list, dict, or any of the base GraphQL types
    
            Args:
                method_name (str): The method name
    Severity: Minor
    Found in graphqler/utils/objects_bucket.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

    There are no issues that match your filters.

    Category
    Status