datacoves/dbt-coves

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

Summary

Maintainability
C
1 day
Test Coverage

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

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 generate_or_append_metadata has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def generate_or_append_metadata(self, relation, destination, options, action, existing_rows):
            destination.parent.mkdir(parents=True, exist_ok=True)
            if action == "append":
                python_fs_action = "a"
            if action == "create":
    Severity: Minor
    Found in dbt_coves/tasks/generate/metadata.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_nested_keys has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_nested_keys(self, json_cols, relation):
            config_db = self.get_config_value("database")
            if config_db:
                config_db += "."
            else:
    Severity: Minor
    Found in dbt_coves/tasks/generate/metadata.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_or_append_metadata has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def generate_or_append_metadata(self, relation, destination, options, action, existing_rows):
    Severity: Minor
    Found in dbt_coves/tasks/generate/metadata.py - About 35 mins to fix

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

          def run(self):
              self.no_prompt = self.get_config_value("no_prompt")
              config_database = self.get_config_value("database")
              self.db = config_database or self.config.credentials.database
      
      
      Severity: Minor
      Found in dbt_coves/tasks/generate/metadata.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