django/db/backends/sqlite3/operations.py
File operations.py
has 349 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import datetime
import decimal
import uuid
from functools import lru_cache
from itertools import chain
Function check_expression_support
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
def check_expression_support(self, expression):
bad_fields = (models.DateField, models.DateTimeField, models.TimeField)
bad_aggregates = (models.Sum, models.Avg, models.Variance, models.StdDev)
if isinstance(expression, bad_aggregates):
for expr in expression.get_source_expressions():
- 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 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def sql_flush(self, style, tables, *, reset_sequences=False, allow_cascade=False):
Function datetime_trunc_sql
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def datetime_trunc_sql(self, lookup_type, sql, params, tzname):
Function on_conflict_suffix_sql
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def on_conflict_suffix_sql(self, fields, on_conflict, update_fields, unique_fields):
Function time_trunc_sql
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def time_trunc_sql(self, lookup_type, sql, params, tzname=None):
Function datetime_extract_sql
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def datetime_extract_sql(self, lookup_type, sql, params, tzname):