Function build_extra_filters
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
def build_extra_filters( # pylint: disable=too-many-locals,too-many-nested-blocks
layout: dict[str, dict[str, Any]],
filter_scopes: dict[str, dict[str, Any]],
default_filters: dict[str, dict[str, list[Any]]],
slice_id: int,
- 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
File utils.py
has 416 lines of code (exceeds 250 allowed). Consider refactoring. Open
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
Function get_form_data
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def get_form_data(
slice_id: Optional[int] = None,
use_slice_data: bool = False,
initial_form_data: Optional[dict[str, Any]] = None,
) -> tuple[dict[str, Any], Optional[Slice]]:
- 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 add_sqllab_custom_filters
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def add_sqllab_custom_filters(form_data: dict[Any, Any]) -> Any:
"""
SQLLab can include a "filters" attribute in the templateParams.
The filters attribute is a list of filters to include in the
request. Useful for testing templates in SQLLab.
- 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 _deserialize_results_payload
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _deserialize_results_payload(
payload: Union[bytes, str], query: Query, use_msgpack: Optional[bool] = False
) -> dict[str, Any]:
logger.debug("Deserializing from msgpack: %r", use_msgpack)
if use_msgpack:
- 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 filter_config in filter_configs:
if filter_config["column"] == col:
is_multiple = filter_config["multiple"]
if not is_multiple and isinstance(val, list):
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 get_viz
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_viz(
Function build_extra_filters
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def build_extra_filters( # pylint: disable=too-many-locals,too-many-nested-blocks