datacoves/dbt-coves

View on GitHub
dbt_coves/tasks/generate/base.py

Summary

Maintainability
D
2 days
Test Coverage

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

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

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

            def new_object_exists_in_current_yml(
        Severity: Minor
        Found in dbt_coves/tasks/generate/base.py - About 35 mins to fix

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

              def render_templates(self, relation, columns, destination, options=None, json_cols=None):
          Severity: Minor
          Found in dbt_coves/tasks/generate/base.py - About 35 mins to fix

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

                def render_property_file(self, template, context, model_yml, templates_folder):
            Severity: Minor
            Found in dbt_coves/tasks/generate/base.py - About 35 mins to fix

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

                  def new_object_exists_in_current_yml(
                      self,
                      current_yml,
                      template,
                      context,
              Severity: Minor
              Found in dbt_coves/tasks/generate/base.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