datacoves/dbt-coves

View on GitHub
dbt_coves/tasks/generate/airflow_generators/fivetran.py

Summary

Maintainability
C
7 hrs
Test Coverage

Function get_pipeline_connection_ids has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    def get_pipeline_connection_ids(
        self, source_db: str, source_schema: str, source_table: str
    ) -> str:
        """
        Given a table name, schema and db, returns the corresponding Fivetran Connection ID
Severity: Minor
Found in dbt_coves/tasks/generate/airflow_generators/fivetran.py - About 3 hrs 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 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(
Severity: Major
Found in dbt_coves/tasks/generate/airflow_generators/fivetran.py - About 1 hr to fix

    Function _dbt_schema_table_in_connector has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def _dbt_schema_table_in_connector(self, connector_schemas, dbt_schema, dbt_table):
            for schema_details in connector_schemas.values():
                if schema_details.get("name_in_destination", "").lower() == dbt_schema:
                    for table_details in schema_details.get("tables", {}).values():
                        if table_details.get("name_in_destination", "").lower() == dbt_table:
    Severity: Minor
    Found in dbt_coves/tasks/generate/airflow_generators/fivetran.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

    Avoid deeply nested control flow statements.
    Open

                            for schema_id, schema_data in connector_data.get("schemas", {}).items():
                                if (
                                    self._dbt_schema_table_in_connector(
                                        {schema_id: schema_data},
                                        source_schema.lower(),
    Severity: Major
    Found in dbt_coves/tasks/generate/airflow_generators/fivetran.py - About 45 mins to fix

      Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(
      Severity: Minor
      Found in dbt_coves/tasks/generate/airflow_generators/fivetran.py - About 35 mins to fix

        Function _get_fivetran_connector_name_for_id has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def _get_fivetran_connector_name_for_id(self, connector_id):
                """
                Create a name for Fivetran tasks based on a Connector ID
                """
                for dest_data in self.fivetran_data.values():
        Severity: Minor
        Found in dbt_coves/tasks/generate/airflow_generators/fivetran.py - About 25 mins 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

        There are no issues that match your filters.

        Category
        Status