File fivetran.py
has 346 lines of code (exceeds 250 allowed). Consider refactoring. Open
from pathlib import Path
import questionary
from rich.console import Console
Function run
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def run(self) -> int:
self.load_results = {
"groups": {"created": set()},
"destinations": {"created": set(), "updated": set()},
"connectors": {"created": set(), "updated": set()},
- 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 _load_fivetran_local_secrets
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def _load_fivetran_local_secrets(self, fivetran_object):
"""
Identify secret files' key:values and replace Fivetran object ones
"""
for secret in self.local_secrets:
- 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 _load_fivetran_datacoves_secrets
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _load_fivetran_datacoves_secrets(self, fivetran_object):
for secret in self.secret_manager_data:
for destination_data in fivetran_object.values():
object_details = destination_data["details"]
if object_details["id"] == secret.get("slug", ""):
- 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 _update_or_create_fivetran_destination
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _update_or_create_fivetran_destination(self, exported_destination, target_group_id):
"""
Given exported destination data
- update if ID exists
- create a new one if doesn't
- 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
Avoid deeply nested control flow statements. Open
for k, v in secret_data.items():
self._replace_dict_key(object_details, k, v)
Function _update_target_connector_schema_config
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _update_target_connector_schema_config(self, connector, extracted_schemas):
connector_id = connector["id"]
connector_schemas = self.fivetran_api._get_connector_schemas(connector_id)
if connector_schemas:
self.fivetran_api.update_connector_schema_config(connector_id, extracted_schemas)
- 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 _print_load_results
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _print_load_results(self):
for obj_type, result_dict in self.load_results.items():
for activity, result in result_dict.items():
if len(result) > 0:
console.print(
- 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"