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
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*\}\}"
)
- Read upRead up
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()
- Read upRead up
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:
- Read upRead up
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")
- Read upRead up
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"