Reduce cognitive complexity in circuit breaker decorators #63

Merged
coding-agent-marvin8 merged 0 commits from refs/pull/63/head into main 2026-06-30 05:45:41 +00:00
coding-agent-marvin8 commented 2026-06-30 04:14:25 +00:00 (Migrated from codeberg.org)

circuit_breaker_decorator and circuit_protected_call both scored 17 (threshold: 15) due to deeply nested closures. Extracted four module-level helpers (_run_protected_async, _run_protected_sync, _run_decorated_async, _run_decorated_sync) that hold the actual execution logic; the decorator factories become thin dispatchers. Both functions now score 2. No behaviour change — all 170 tests pass.

Closes #62

circuit_breaker_decorator and circuit_protected_call both scored 17 (threshold: 15) due to deeply nested closures. Extracted four module-level helpers (_run_protected_async, _run_protected_sync, _run_decorated_async, _run_decorated_sync) that hold the actual execution logic; the decorator factories become thin dispatchers. Both functions now score 2. No behaviour change — all 170 tests pass. Closes #62
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
marvin8/dujiangyan!63
No description provided.