Skip to content

Commit d6cdb73

Browse files
committed
improved readability of the funding compliance check while addressing PLR0912 (too many branches)
1 parent fdccea0 commit d6cdb73

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

backend/apps/github/models/repository.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -295,16 +295,21 @@ def _process_funding_data(self, gh_repository):
295295
self.has_funding_yml = True
296296

297297
# Check funding policy compliance
298-
self.is_funding_policy_compliant = all(
299-
check_funding_policy_compliance(platform, target)
300-
for platform, targets in self.funding_yml.items()
301-
for target in (targets if isinstance(targets, list) else [targets])
302-
if target
303-
)
298+
self.is_funding_policy_compliant = self._check_all_funding_compliance()
304299
except (AttributeError, GithubException):
305300
self.has_funding_yml = False
306301
self.is_funding_policy_compliant = True
307302

303+
def _check_all_funding_compliance(self) -> bool:
304+
"""Check if all funding targets are policy compliant."""
305+
for platform, targets in self.funding_yml.items():
306+
# Normalize to list for consistent processing
307+
target_list = targets if isinstance(targets, list) else [targets]
308+
for target in target_list:
309+
if target and not check_funding_policy_compliance(platform, target):
310+
return False
311+
return True
312+
308313
@staticmethod
309314
def update_data(
310315
gh_repository,

0 commit comments

Comments
 (0)