graphqler/graph/graph_generator.py
Function create_object_mutation_edges
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
Open
def create_object_mutation_edges(self, object_nodes: dict, mutation_nodes: dict):
"""Updates the dependency graph with edges between objects and mutations. 3 cases:
Case 1: M -> O | When object(O) depends on mutation(M), means O has M in its "associatedMutations", weight 100
Case 2: O -> M | When mutation(M) depends on object(O), means M has O in its "hardDependsOn", weight 100
Case 3: O -> M | When mutation(M) depends on object(O), means M has O in its "softDependsOn", weight 1
- Read upRead up
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 create_object_query_edges
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
Open
def create_object_query_edges(self, object_nodes: dict, query_nodes: dict):
"""Updates the dependency graph with edges in between objects and queries. 3 cases:
Case 1: M -> O | When object(O) is produced by query(Q), means O has Q in its "associatedQueries", weight 100
Case 2: O -> Q | When query(Q) depends on object(O), means Q has O in its "hardDependsOn", weight 100
Case 3: O -> Q | When query(Q) depends on object(O), means Q has O in its "softDependsOn", weight 1
- Read upRead up
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"