BaseDatabaseOperations has 74 functions (exceeds 20 allowed). Consider refactoring. Open
class BaseDatabaseOperations: """ Encapsulate backend-specific differences, such as the way a backend performs ordering or calculates the ID of a recently-inserted row. """
operations.py has 585 lines of code (exceeds 250 allowed). Consider refactoring. Open
import datetime import decimal from importlib import import_module import sqlparse
explain_query_prefix has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def explain_query_prefix(self, format=None, **options): if not self.connection.features.supports_explaining_query_execution: raise NotSupportedError('This backend does not support explaining query execution.') if format: supported_formats = self.connection.features.supported_explain_formats
- Read upRead up
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"
sql_flush has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def sql_flush(self, style, tables, *, reset_sequences=False, allow_cascade=False):
Avoid too many
return statements within this function. Open