Showing 2,441 of 6,157 total issues
Function build_sqlalchemy_uri
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def build_sqlalchemy_uri(
self, data: dict[str, Any], **kwargs: Any
) -> dict[str, Any]:
"""
Build SQLAlchemy URI from separate parameters.
- 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 _get_content
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _get_content(self) -> EmailContent:
if self._content.text:
return EmailContent(body=self._error_template(self._content.text))
# Get the domain from the 'From' address ..
# and make a message id without the < > in the end
- 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
for idx, key in enumerate(value[relation]):
if key in mapping:
value[relation][idx] = mapping[key]
# Remove the filter-box charts from the dashboard/slice mapping.
Avoid deeply nested control flow statements. Open
if col + size_x <= current_col:
lower.append(position)
continue
elif col >= current_col:
upper.append(position)
Avoid deeply nested control flow statements. Open
for parent_id in fltr.get("cascadeParentIds", [])[:]:
if parent_id not in filter_ids:
fltr["cascadeParentIds"].remove(parent_id)
updated = True
Avoid deeply nested control flow statements. Open
if new_pvm not in role.permissions:
logger.info(f"Add {new_pvm} to {role}")
role.permissions.append(new_pvm)
# Delete old permissions
Avoid deeply nested control flow statements. Open
if len(lower) == 1:
chart_holder = get_chart_holder(lower[0])
root[chart_holder["id"]] = chart_holder
row_container["children"].append(chart_holder["id"])
else:
Function upgrade
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def upgrade():
bind = op.get_bind()
session = db.Session(bind=bind)
for slc in paginated_update(
- 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 upgrade_comparison_params
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def upgrade_comparison_params(slice_params: dict[str, Any]) -> dict[str, Any]:
params = deepcopy(slice_params)
# Update time_comparison to time_compare
if "time_comparison" in params:
- 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 import_from_dict
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def import_from_dict(
Avoid deeply nested control flow statements. Open
if key in query:
del query[key]
updated = True
Function validate_adhoc_subquery
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def validate_adhoc_subquery(
sql: str,
database_id: int,
engine: str,
default_schema: str,
- 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 eq:
cond = or_(is_null_cond, sqla_col.in_(eq_without_none))
else:
cond = is_null_cond
else:
Avoid deeply nested control flow statements. Open
if column_name := column_.get("column_name"):
column_names.add(column_name)
# Columns used in query filters
column_names.update(
Function get_permissions
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_permissions(
user: User,
) -> tuple[dict[str, list[tuple[str]]], DefaultDict[str, list[str]]]:
if not user.roles:
raise AttributeError("User object does not have roles")
- 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 downgrade
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def downgrade():
bind = op.get_bind()
session = db.Session(bind=bind)
for slc in session.query(Slice).filter(Slice.viz_type == "pie").all():
- 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 _delete
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _delete(self: BaseView, primary_key: int) -> None:
"""
Delete function logic, override to implement different logic
deletes the record with primary_key = primary_key
- 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 target_generic_type != GenericDataType.STRING:
sqla_col = sa.cast(sqla_col, sa.String)
Avoid deeply nested control flow statements. Open
for key in keys:
val = filter_immune_slice_fields[key]
if "__from" in val:
val.remove("__from")
if "__to" in val:
Function downgrade
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def downgrade():
bind = op.get_bind()
metadata = sa.MetaData(bind=bind)
op.add_column(
- 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"