datacoves/dbt-coves

View on GitHub

Showing 92 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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    Severity: Major
    Found in dbt_coves/tasks/extract/main.py and 1 other location - About 1 day to fix
    dbt_coves/tasks/load/main.py on lines 0..30

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 122.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    Severity: Major
    Found in dbt_coves/tasks/load/main.py and 1 other location - About 1 day to fix
    dbt_coves/tasks/extract/main.py on lines 0..30

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 122.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          @classmethod
          def register_parser(cls, sub_parsers, base_subparser):
              ext_subparser = sub_parsers.add_parser(
                  "setup",
                  parents=[base_subparser],
      Severity: Major
      Found in dbt_coves/tasks/setup/main.py and 1 other location - About 5 hrs to fix
      dbt_coves/tasks/generate/main.py on lines 32..46

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 90.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          @classmethod
          def register_parser(cls, sub_parsers, base_subparser):
              gen_subparser = sub_parsers.add_parser(
                  "generate",
                  parents=[base_subparser],
      Severity: Major
      Found in dbt_coves/tasks/generate/main.py and 1 other location - About 5 hrs to fix
      dbt_coves/tasks/setup/main.py on lines 33..45

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 90.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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

                Severity
                Category
                Status
                Source
                Language