Showing 1,784 of 2,092 total issues
Function add_deferred_loading
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_deferred_loading(self, field_names):
"""
Add the given list of model field names to the set of fields to
exclude from loading from the database when automatic column selection
is done. Add the new field names to any existing field names that
- 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
Avoid deeply nested control flow statements. Open
if self.annotation_select:
self.names_to_path(f.split(LOOKUP_SEP), self.model._meta)
field_names.append(f)
Avoid deeply nested control flow statements. Open
for expr in self.group_by:
annotation_mask |= expr.get_refs()
for aggregate in aggregates.values():
Function _alter_column_type_sql
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _alter_column_type_sql(
Avoid deeply nested control flow statements. Open
if annotation.get_group_by_cols():
annotation_mask.add(annotation_alias)
inner_query.set_annotation_mask(annotation_mask)
Function add_update_values
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_update_values(self, values):
"""
Convert a dictionary of field name to value mappings into an update
query. This is the entry point for the public update() method on
querysets.
- 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 _alter_column_type_sql
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _alter_column_type_sql(
Function sql_flush
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def sql_flush(self, style, tables, *, reset_sequences=False, allow_cascade=False):
Function run_validators
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def run_validators(self, value):
if value in self.empty_values:
return
errors = []
for v in self.validators:
- 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 date_extract_sql
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def date_extract_sql(self, lookup_type, sql, params):
extract_sql = f"TO_CHAR({sql}, %s)"
extract_param = None
if lookup_type == "week_day":
# TO_CHAR(field, 'D') returns an integer from 1-7, where 1=Sunday.
- 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
Avoid deeply nested control flow statements. Open
if self.match is None or self.match_re.search(f):
f = os.path.join(root, f)
self.choices.append((f, f.replace(path, "", 1)))
else:
Function _iter_column_sql
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _iter_column_sql(
Function _alter_column_type_sql
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _alter_column_type_sql(
Function value_from_datadict
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def value_from_datadict(self, data, files, name):
y = data.get(self.year_field % name)
m = data.get(self.month_field % name)
d = data.get(self.day_field % name)
if y == m == d == "":
- 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 quote_value
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def quote_value(self, value):
if isinstance(value, (datetime.date, datetime.time, datetime.datetime)):
return "'%s'" % value
elif isinstance(value, datetime.timedelta):
return "'%s'" % duration_iso_string(value)
- 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
def sql_flush(self, style, tables, *, reset_sequences=False, allow_cascade=False):
Function render
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def render(
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Avoid deeply nested control flow statements. Open
if self.match is None or self.match_re.search(f):
f = os.path.join(root, f)
self.choices.append((f, f.replace(path, "", 1)))
if self.allow_folders:
Function _alter_column_type_sql
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _alter_column_type_sql(