Showing 74 of 86 total issues
Function create_failure_handler
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def create_failure_handler(self, handlers_config: dict) -> Callable:
def failure_handler(context: Any) -> None:
for handler_definition in handlers_config:
if handler_definition["type"] == "slack":
connection = BaseHook.get_connection(handler_definition["connection_id"])
- 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 __init__
has 9 arguments (exceeds 6 allowed). Consider refactoring. Open
def __init__(
Function __init__
has 9 arguments (exceeds 6 allowed). Consider refactoring. Open
def __init__(
Avoid too many return
statements within this function. Open
return self._create_task_for_model(
Missing module docstring Open
from dataclasses import dataclass
- Read upRead up
- Exclude checks
Used when a module has no docstring.Empty modules do not require a docstring.
Missing function or method docstring Open
def create_config(
- Read upRead up
- Exclude checks
Used when a function or method has no docstring.Some special methods like init do not require a docstring.
Too few public methods (1/2) Open
class BashExecutionParametersLoader:
- Read upRead up
- Exclude checks
Used when class has too few public methods, so be sure it's really worth it.
Too few public methods (1/2) Open
class EcsPodOperatorBuilder(DbtRunOperatorBuilder):
- Read upRead up
- Exclude checks
Used when class has too few public methods, so be sure it's really worth it.
Unnecessary else
after return
Open
if IS_FIRST_AIRFLOW_VERSION:
- Read upRead up
- Exclude checks
Used in order to highlight an unnecessary block of code following an if containing a return statement. As such, it will warn when it encounters an else following a chain of ifs, all of them containing a return statement.
Import from dbt_graph_builder.node_type import NodeType
should be placed at the top of the module Open
from dbt_graph_builder.node_type import NodeType
- Read upRead up
- Exclude checks
Used when code and imports are mixed
Missing class docstring Open
class EcsExecutionParametersLoader:
- Read upRead up
- Exclude checks
Used when a class has no docstring.Even an empty class must have a docstring.
Import from dbt_airflow_factory.operator import DbtRunOperatorBuilder, EphemeralOperator
should be placed at the top of the module Open
from dbt_airflow_factory.operator import DbtRunOperatorBuilder, EphemeralOperator
- Read upRead up
- Exclude checks
Used when code and imports are mixed
Missing class docstring Open
@dataclass(frozen=True)
- Read upRead up
- Exclude checks
Used when a class has no docstring.Even an empty class must have a docstring.
Too few public methods (1/2) Open
class BashOperatorBuilder(DbtRunOperatorBuilder):
- Read upRead up
- Exclude checks
Used when class has too few public methods, so be sure it's really worth it.
Missing class docstring Open
class KubernetesExecutionParametersLoader:
- Read upRead up
- Exclude checks
Used when a class has no docstring.Even an empty class must have a docstring.
Too many local variables (19/15) Open
def __init__(
- Read upRead up
- Exclude checks
Used when a function or method has too many local variables.
Unnecessary elif
after return
Open
if handler_definition["type"] == "slack":
- Read upRead up
- Exclude checks
Used in order to highlight an unnecessary block of code following an if containing a return statement. As such, it will warn when it encounters an else following a chain of ifs, all of them containing a return statement.
Missing function or method docstring Open
def create_config(
- Read upRead up
- Exclude checks
Used when a function or method has no docstring.Some special methods like init do not require a docstring.
Too few public methods (1/2) Open
class NotificationHandlersFactory:
- Read upRead up
- Exclude checks
Used when class has too few public methods, so be sure it's really worth it.
Import outside toplevel (kubernetes.client) Open
from kubernetes.client import models as k8s
- Read upRead up
- Exclude checks
Used when an import statement is used anywhere other than the module toplevel. Move this import to the top of the file.