Showing 2,441 of 6,157 total issues
Function load_contents
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def load_contents(load_test_data: bool = False) -> dict[str, Any]:
"""Traverse configs directory and load contents"""
root = files("superset") / "examples/configs"
resource_names = (files("superset") / str(root)).iterdir()
queue = [root / str(resource_name) for resource_name in resource_names]
- 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 findNonTabChildChartIds
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function findNonTabChildChartIds({ id, layout }) {
const chartIds = [];
function recurseFromNode(node) {
if (node && node.type === CHART_TYPE) {
if (node.meta && node.meta.chartId) {
- 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 parse_querystring
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def parse_querystring(qs):
d = {}
for k, v in parse.parse_qsl(qs):
if k not in d:
d[k] = v
- 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 sample.tzinfo:
tz = sample.tzinfo
series = pd.Series(array[column])
series = pd.to_datetime(series)
pa_data[i] = pa.Array.from_pandas(
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).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
Avoid deeply nested control flow statements. Open
if child["filterType"] == "filter_select":
for parent in filter_by_key_and_field[str(other.id)].values():
if (
parent["filterType"] in {"filter_select", "filter_time"}
and parent["id"] not in child["cascadeParentIds"]
Function upgrade
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def upgrade():
op.add_column(
"datasources", Column("schema_perm", String(length=1000), nullable=True)
)
op.add_column("slices", Column("schema_perm", String(length=1000), nullable=True))
- 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 key in keys:
val = filters[key]
__from = val.pop("__from", "")
__to = val.pop("__to", "")
# if user already defined __time_range,
Function create_tag_relationship
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create_tag_relationship(
objects_to_tag: list[tuple[ObjectType, int]],
tag: Tag,
bulk_create: bool = False,
) -> None:
- 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 getattr(record, col.name) == "":
setattr(record, col.name, None)
Avoid deeply nested control flow statements. Open
while has_wide_columns:
col_ids = get_wide_column_ids(item["children"], root)
idx = 0
# need 2nd loop since same column may reduce multiple times
while idx < len(col_ids) and current_width > GRID_COLUMN_COUNT:
Avoid deeply nested control flow statements. Open
if is_physical and drivername:
quoted_expression = get_identifier_quoter(drivername)(
column_name
)
if quoted_expression != column_name:
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 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 extra_validator
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def extra_validator(value: str) -> str:
"""
Validate that extra is a valid JSON string, and that metadata_params
keys are on the call signature for SQLAlchemy Metadata
"""
- 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 config["column"] == field:
fltr.update(
{
"controlValues": {
"defaultToFirstItem": False,
Avoid deeply nested control flow statements. Open
if value is not None and re.search(r"^\s+|\s+$", value):
setattr(record, col.name, value.strip())
Avoid deeply nested control flow statements. Open
if value is not None and value.strip() == "":
setattr(record, col.name, None)
Avoid deeply nested control flow statements. Open
if how:
params["resample_method"] = how
Function put
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def put(self, pk: int) -> Response:
"""Update a database.
---
put:
summary: Change a database
- 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 fill_method:
params["resample_method"] = fill_method
# Ensure that the resample logic is fully defined.
if "resample_method" not in params: