datacoves/dbt-coves

View on GitHub

Showing 88 of 92 total issues

Function parse_args has a Cognitive Complexity of 296 (exceeds 5 allowed). Consider refactoring.
Open

    def parse_args(self, cli_args: List[str] = list()) -> None:
        args = sys.argv[1:]

        # TODO: FIXME: This is a temporary logic for when --dbt-args is followed by a single-word string,
        # like cases of --dbt-args "--no-compile",
Severity: Minor
Found in dbt_coves/utils/flags.py - About 6 days 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 airbyte.py has 514 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import json
import os
import pathlib
from copy import copy

Severity: Major
Found in dbt_coves/tasks/load/airbyte.py - About 1 day to fix

    File base.py has 417 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import csv
    import fnmatch
    from pathlib import Path
    
    import questionary
    Severity: Minor
    Found in dbt_coves/tasks/generate/base.py - About 6 hrs to fix

      Function render_property_files has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

          def render_property_files(
              self,
              context,
              options,
              templates_folder,
      Severity: Minor
      Found in dbt_coves/tasks/generate/base.py - About 5 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 airflow_dags.py has 383 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import datetime
      import importlib
      import textwrap
      from glob import glob
      from pathlib import Path
      Severity: Minor
      Found in dbt_coves/tasks/generate/airflow_dags.py - About 5 hrs to fix

        Function discover_dbt_connections has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
        Open

            def discover_dbt_connections(self) -> Set[str]:
                """
                Discover DBT source(s)' Airbyte/Fivetran connection IDs based on params
                """
                if self.virtualenv_path:
        Severity: Minor
        Found in dbt_coves/tasks/generate/airflow_generators/base.py - About 5 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 flags.py has 358 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        """Flags module containing the DbtCovesFlags "Factory"."""
        
        import os
        import sys
        from argparse import ArgumentParser
        Severity: Minor
        Found in dbt_coves/utils/flags.py - About 4 hrs to fix

          File sources.py has 358 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          from __future__ import nested_scopes
          
          import json
          from pathlib import Path
          
          
          Severity: Minor
          Found in dbt_coves/tasks/generate/sources.py - About 4 hrs to fix

            File fivetran.py has 346 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            from pathlib import Path
            
            import questionary
            from rich.console import Console
            
            
            Severity: Minor
            Found in dbt_coves/tasks/load/fivetran.py - About 4 hrs to fix

              Function run_git_clone has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
              Open

                  def run_git_clone(self, workspace_path):
                      repo_url = ""
                      cloned_status = "[red]MISSING[/red]"
                      cloned_exists = Path(workspace_path, ".git").exists()
                      if cloned_exists:
              Severity: Minor
              Found in dbt_coves/tasks/setup/git.py - About 4 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 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 get_relations has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
              Open

                  def get_relations(self, filtered_schemas):
                      rel_name_selectors = [relation for relation in self.get_config_value("select_relations")]
              
                      rel_excludes = [relation for relation in self.get_config_value("exclude_relations")]
              
              
              Severity: Minor
              Found in dbt_coves/tasks/generate/base.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 run has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
              Open

                  def run(self) -> int:
                      self.load_results = {
                          "groups": {"created": set()},
                          "destinations": {"created": set(), "updated": set()},
                          "connectors": {"created": set(), "updated": set()},
              Severity: Minor
              Found in dbt_coves/tasks/load/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 generate has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
              Open

                  def generate(self, rels):
                      self.flatten_json = self.get_config_value("flatten_json_fields")
                      self.overwrite_sqls = self.get_config_value("overwrite_staging_models")
                      models_destination = self.get_config_value("models_destination")
                      options = {
              Severity: Minor
              Found in dbt_coves/tasks/generate/sources.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

              File config.py has 294 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              """Holds config for dbt-coves."""
              
              import os
              import re
              from pathlib import Path
              Severity: Minor
              Found in dbt_coves/config/config.py - About 3 hrs to fix

                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 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_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 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

                Severity
                Category
                Status
                Source
                Language