Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
self.config = None
self.clock = clock

def configure(self, client_conf: dict, rule_conf: dict):

Check failure on line 63 in src/confluent_kafka/schema_registry/rules/encryption/encrypt_executor.py

View check run for this annotation

SonarQube-Confluent / confluent-kafka-python Sonarqube Results

src/confluent_kafka/schema_registry/rules/encryption/encrypt_executor.py#L63

Refactor this function to reduce its Cognitive Complexity from 26 to the 15 allowed.
if client_conf:
if self.client:
if self.client.config() != client_conf:
Expand All @@ -68,17 +68,17 @@
else:
self.client = DekRegistryClient.new_client(client_conf)

if rule_conf:
if self.config:
if self.config:
if rule_conf:
for key, value in rule_conf.items():
v = self.config.get(key)
if v is not None:
if v != value:
raise RuleError(f"rule config key already set: {key}")
else:
self.config[key] = value
else:
self.config = rule_conf
else:
self.config = rule_conf if rule_conf else {}

def type(self) -> str:
return "ENCRYPT"
Expand Down