DatabaseOperations
has 40 functions (exceeds 20 allowed). Consider refactoring. Open
class DatabaseOperations(BaseDatabaseOperations):
cast_char_field_without_max_length = "varchar"
explain_prefix = "EXPLAIN"
explain_options = frozenset(
[
File operations.py
has 319 lines of code (exceeds 250 allowed). Consider refactoring. Open
import json
from functools import lru_cache, partial
from django.conf import settings
from django.db.backends.base.operations import BaseDatabaseOperations
Function last_executed_query
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def last_executed_query(self, cursor, sql, params):
if self.connection.features.uses_server_side_binding:
try:
return self.compose_sql(sql, params)
except errors.DataError:
- 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 explain_query_prefix
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def explain_query_prefix(self, format=None, **options):
extra = {}
# Normalize options.
if options:
options = {
- 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 sql_flush
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def sql_flush(self, style, tables, *, reset_sequences=False, allow_cascade=False):
Function sequence_reset_sql
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def sequence_reset_sql(self, style, model_list):
from django.db import models
output = []
qn = self.quote_name
- 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"