datacoves/dbt-coves

View on GitHub

Showing 88 of 93 total issues

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

    def run(self) -> int:
        self.extraction_results = set()

        extract_destination = self.get_config_value("path")
        self.api_key = self.get_config_value("api_key")
Severity: Minor
Found in dbt_coves/tasks/extract/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 _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

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

    def dbt_deps(self, config_folder=None):
        if not config_folder:
            config_folder = self.get_config_folder(mandatory=False)

        if config_folder:
Severity: Minor
Found in dbt_coves/tasks/setup/dbt.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_connection_schema has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def _get_connection_schema(self, conn, destination_config):
        """Given an airybte connection, returns a schema name"""
        namespace_definition = conn["namespaceDefinition"]

        if namespace_definition == "source" or (
Severity: Minor
Found in dbt_coves/tasks/generate/airflow_generators/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 replace_env_vars has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def replace_env_vars(self, yaml_dict: Dict) -> Dict:
        # regex -> {{ env_var('ENV_VAR_NAME', 'DEFAULT_VALUE') }}
        env_var_pattern = re.compile(
            r"\{\{\s*env_var\s*\(\s*['\"]?\s*([^'\"]+)['\"]?\s*(?:,\s*['\"]?\s*([^'\"]+)['\"]?\s*)?\)\s*\}\}"
        )
Severity: Minor
Found in dbt_coves/config/config.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_fivetran_datacoves_secrets has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def _load_fivetran_datacoves_secrets(self, fivetran_object):
        for secret in self.secret_manager_data:
            for destination_data in fivetran_object.values():
                object_details = destination_data["details"]
                if object_details["id"] == secret.get("slug", ""):
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 make_query has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def make_query(self) -> SelectAny:
        table = self.table
        query = table.select()
        if not self.incremental:
            return query
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 modify_property_file has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def modify_property_file(
Severity: Major
Found in dbt_coves/tasks/generate/base.py - About 1 hr to fix

    Function sql_database has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def sql_database(
    Severity: Major
    Found in dbt_coves/tasks/data_sync/sql_database/__init__.py - About 1 hr to fix

      Function _update_or_create_fivetran_destination has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def _update_or_create_fivetran_destination(self, exported_destination, target_group_id):
              """
              Given exported destination data
              - update if ID exists
              - create a new one if doesn't
      Severity: Minor
      Found in dbt_coves/tasks/load/fivetran.py - About 55 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

      Function run has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def run(self):
              self.loading_results = {
                  "sources": {"updated": [], "created": []},
                  "destinations": {"updated": [], "created": []},
                  "connections": {"updated": [], "created": []},
      Severity: Minor
      Found in dbt_coves/tasks/load/airbyte.py - About 55 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

      Function get_metadata has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_metadata(self):
              """
              If metadata path is configured, returns a dictionary with column keys
              and their corresponding values.
              If metadata is already set, do not load again and return the existing value.
      Severity: Minor
      Found in dbt_coves/tasks/generate/base.py - About 55 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

      Function table_rows has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def table_rows(
      Severity: Major
      Found in dbt_coves/tasks/data_sync/sql_database/helpers.py - About 50 mins to fix

        Function render_property_files has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def render_property_files(
        Severity: Major
        Found in dbt_coves/tasks/generate/base.py - About 50 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  for k, v in secret_data.items():
                                      self._replace_dict_key(object_details, k, v)
          
          
          Severity: Major
          Found in dbt_coves/tasks/load/fivetran.py - About 45 mins to fix

            Function main has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            def main(parser: argparse.ArgumentParser = parser, test_cli_args: List[str] = list()) -> int:
                tracking.do_not_track()
            
                exit_code = 0
                cli_args = test_cli_args or []
            Severity: Minor
            Found in dbt_coves/core/main.py - About 45 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

            Function integrated has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def integrated(self):
                    """
                    Returns the values read from the config file plus the overrides from cli flags
                    """
                    config_copy = self._config.dict()
            Severity: Minor
            Found in dbt_coves/config/config.py - About 45 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

            Avoid deeply nested control flow statements.
            Open

                                    if (airbyte_schema == schema or not airbyte_schema) and conn.get(
                                        "connectionId"
                                    ) not in connection_ids:
                                        connection_ids.append(conn["connectionId"])
                    if connection_ids:
            Severity: Major
            Found in dbt_coves/tasks/generate/airflow_generators/airbyte.py - About 45 mins to fix

              Function list_from_dbt_ls has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def list_from_dbt_ls(self, output):
                      user_selectors = list()
                      if self.get_config_value("select"):
                          user_selectors.append("--select")
                          user_selectors.append(self.get_config_value("select"))
              Severity: Minor
              Found in dbt_coves/tasks/generate/properties.py - About 45 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

              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
                Severity
                Category
                Status
                Source
                Language