datacoves/dbt-coves

View on GitHub

Showing 93 of 93 total issues

Function generate has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    def generate(self, rels):
        destination = self.get_config_value("destination")
        options = {"append_all": False, "recreate_files": False}

        for rel in rels:
Severity: Minor
Found in dbt_coves/tasks/generate/metadata.py - About 2 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 get_schemas has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    def get_schemas(self):
        # get schema names selectors
        schema_name_selectors = [schema for schema in self.get_config_value("schemas")]

        schema_wildcard_selectors = []
Severity: Minor
Found in dbt_coves/tasks/generate/base.py - About 2 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 run_git_config has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    def run_git_config(self):
        config_status = "[red]MISSING[/red]"

        email_output = run_and_capture(["git", "config", "--global", "--get", "user.email"])
        email_exists = email_output.returncode == 0 and email_output.stdout
Severity: Minor
Found in dbt_coves/tasks/setup/git.py - About 2 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 get_pipeline_connection_ids has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def get_pipeline_connection_ids(self, db: str, schema: str, table: str) -> str:
        """
        Given a table name, schema and db, returns the corresponding Airbyte Connection ID
        """
        airbyte_tables = []
Severity: Minor
Found in dbt_coves/tasks/generate/airflow_generators/airbyte.py - About 2 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 run has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def run(self):
        options = {"overwrite_all": False}
        dbtcoves_templates_path = Path(dbt_coves.__file__).parent / "templates"

        dbt_project_path = self.config.project_root
Severity: Minor
Found in dbt_coves/tasks/generate/templates.py - About 2 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 generate_task_group has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def generate_task_group(self, tg_name: str, tg_conf: Dict[str, Any]):
        """
        Generate Task Groups, using YML's `generator` or `tasks`
        """
        self.dag_output["imports"].append("from airflow.decorators import task_group\n"),
Severity: Minor
Found in dbt_coves/tasks/generate/airflow_dags.py - About 2 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 _get_secrets has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def _get_secrets(self, exported_json_data, directory):
        """
        Get Airbyte's connectionConfiguration keys and values for a specified filename
        (source.json) and directory or object type: destinations/sources
        """
Severity: Minor
Found in dbt_coves/tasks/load/airbyte.py - About 2 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

File api_caller.py has 258 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import json
from typing import Any, Dict

import requests
from requests.auth import HTTPBasicAuth
Severity: Minor
Found in dbt_coves/utils/api_caller.py - About 2 hrs to fix

    File metadata.py has 251 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import csv
    import json
    from pathlib import Path
    
    import questionary
    Severity: Minor
    Found in dbt_coves/tasks/generate/metadata.py - About 2 hrs to fix

      Function _load_fivetran_local_secrets has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def _load_fivetran_local_secrets(self, fivetran_object):
              """
              Identify secret files' key:values and replace Fivetran object ones
              """
              for secret in self.local_secrets:
      Severity: Minor
      Found in dbt_coves/tasks/load/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

      Function setup_ssh has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def setup_ssh(self):
              ssh_status = "[red]MISSING[/red]"
              ssh_configured = False
              ssh_keys_dir = "~/.ssh/"
              self.ssh_keys_dir_abs = os.path.abspath(Path(ssh_keys_dir).expanduser())
      Severity: Minor
      Found in dbt_coves/tasks/setup/ssh.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 load_secret_manager_data has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      def load_secret_manager_data(task_instance) -> dict:
          payload = {}
          manager = task_instance.secrets_manager.lower()
          if manager == "datacoves":
              # Contact the secrets manager and retrieve Secrets
      Severity: Minor
      Found in dbt_coves/utils/secrets.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 generate_model has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def generate_model(self, relation, destination, options):
              destination.parent.mkdir(parents=True, exist_ok=True)
              columns = self.adapter.get_columns_in_relation(relation)
              nested_field_type = self.NESTED_FIELD_TYPES.get(self.adapter.__class__.__name__)
              nested = [col.name for col in columns if col.dtype == nested_field_type]
      Severity: Minor
      Found in dbt_coves/tasks/generate/sources.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 run has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def run(self) -> int:
              project_dir = self.get_config_value("project_dir")
              if not project_dir:
                  project_dir = os.environ.get("DBT_PROJECT_DIR", os.environ.get("DATACOVES__DBT_HOME"))
              if not project_dir:
      Severity: Minor
      Found in dbt_coves/tasks/dbt/main.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 sql_database has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      def sql_database(
          credentials: Union[ConnectionStringCredentials, Engine, str] = dlt.secrets.value,
          schema: Optional[str] = dlt.config.value,
          metadata: Optional[MetaData] = None,
          table_names: Optional[List[str]] = dlt.config.value,
      Severity: Minor
      Found in dbt_coves/tasks/data_sync/sql_database/__init__.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 _get_secret_value_for_field has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def _get_secret_value_for_field(self, secret_data, field, secret_target_name):
              for k, v in secret_data.items():
                  if k.lower() == field:
                      return v
                  if isinstance(v, dict):
      Severity: Minor
      Found in dbt_coves/tasks/load/airbyte.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 get_metadata_columns has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_metadata_columns(self, relation, cols):
              """
              Get metadata col
              """
              metadata = self.get_metadata()
      Severity: Minor
      Found in dbt_coves/tasks/generate/base.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 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 table_rows has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        def table_rows(
            engine: Engine,
            table: Table,
            chunk_size: int,
            incremental: Optional[dlt.sources.incremental[Any]] = None,
        Severity: Minor
        Found in dbt_coves/tasks/data_sync/sql_database/helpers.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 dag_args_to_string has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def dag_args_to_string(self, yaml, indent=2):
                """
                Converts a dictionary to a string of arguments for the DAG constructor.
                """
                dag_args = ""
        Severity: Minor
        Found in dbt_coves/tasks/generate/airflow_dags.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

        Severity
        Category
        Status
        Source
        Language