getindata/dbt-airflow-factory

View on GitHub

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"])
Severity: Minor
Found in dbt_airflow_factory/notifications/handler.py - About 1 hr to fix

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__(
Severity: Major
Found in dbt_airflow_factory/notifications/ms_teams_webhook_hook.py - About 50 mins to fix

    Function __init__ has 9 arguments (exceeds 6 allowed). Consider refactoring.
    Open

        def __init__(
    Severity: Major
    Found in dbt_airflow_factory/notifications/ms_teams_webhook_operator.py - About 50 mins to fix

      Avoid too many return statements within this function.
      Open

              return self._create_task_for_model(
      Severity: Major
      Found in dbt_airflow_factory/tasks_builder/builder.py - About 30 mins to fix

        Missing module docstring
        Open

        from dataclasses import dataclass

        Used when a module has no docstring.Empty modules do not require a docstring.

        Missing function or method docstring
        Open

            def create_config(

        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:

        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):

        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:

        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

        Used when code and imports are mixed

        Missing class docstring
        Open

        class EcsExecutionParametersLoader:

        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

        Used when code and imports are mixed

        Missing class docstring
        Open

        @dataclass(frozen=True)

        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):

        Used when class has too few public methods, so be sure it's really worth it.

        Missing class docstring
        Open

        class KubernetesExecutionParametersLoader:

        Used when a class has no docstring.Even an empty class must have a docstring.

        Too many local variables (19/15)
        Open

            def __init__(

        Used when a function or method has too many local variables.

        Unnecessary elif after return
        Open

                        if handler_definition["type"] == "slack":

        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(

        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:

        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

        Used when an import statement is used anywhere other than the module toplevel. Move this import to the top of the file.

        Severity
        Category
        Status
        Source
        Language