datacoves/dbt-coves

View on GitHub
dbt_coves/config/config.py

Summary

Maintainability
B
5 hrs
Test Coverage

File config.py has 304 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 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 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

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

        def get_config_folder(cls, workspace_path=None, mandatory=True):
            if not workspace_path:
                workspace_path = Path.cwd()
            config_folders = [path for path in Path(workspace_path).rglob("**/.dbt_coves/")]
            if not config_folders:
    Severity: Minor
    Found in dbt_coves/config/config.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

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

        def locate_config(self) -> None:
            # If path is relative to cwd
            if self._config_path == Path(str()):
                logger.debug("Trying to find .dbt_coves in current folder")
    
    
    Severity: Minor
    Found in dbt_coves/config/config.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