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
Function generate_task_group
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def generate_task_group(self, tg_name: str, tg_conf: Dict[str, Any]):
"""
Generate Task Groups, using YML's `generator` or `tasks`
"""
self.dag_output["imports"].append("from airflow.decorators import task_group\n"),
- 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 dag_args_to_string
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def dag_args_to_string(self, yaml, indent=2):
"""
Converts a dictionary to a string of arguments for the DAG constructor.
"""
dag_args = ""
- 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 run
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def run(self):
ymls_path = self.get_config_value("yml_path")
dags_path = self.get_config_value("dags_path")
if not (ymls_path and dags_path):
raise MissingArgumentException(["--yml-path", "--dags-path"], self.coves_config)
- 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 _discover_secrets
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _discover_secrets(self, yml_dag: Dict[str, Any]):
"""
Load secrets locally/remotely, and merge their 'nodes' into YML file ones
"""
if self.secrets_path:
- 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"