Skip to content

Refactored third party API detection to improve consistency#137

Closed
Mrpopo911 wants to merge 1 commit into
Stanzin7:masterfrom
Mrpopo911:fix/error-handling
Closed

Refactored third party API detection to improve consistency#137
Mrpopo911 wants to merge 1 commit into
Stanzin7:masterfrom
Mrpopo911:fix/error-handling

Conversation

@Mrpopo911

Copy link
Copy Markdown

Description

Refactored third party API detection logic to remove duplication and improve consistency across scoring components.

Issue

Third party API detection logic was implemented in multiple places with slightly different conditions, leading to inconsistent behavior and maintainability issues as well as redundancy.

Fix

  1. Introduced a helper function is_third_party_api
  2. Replaced duplicate logic with a helper function

Impact

  1. Ensures consistent detection of third-party API usage
  2. Improves maintainability and readability
  3. Reduces risk of scoring inconsistencies

@Stanzin7

Copy link
Copy Markdown
Owner

Thanks @Mrpopo911 — it would apply, but it edits dead code. api/scoring_legacy.py (the calculate_security_score / _calculate_permission_alignment_penalty functions) is explicitly retained only for backward-compat (see the module docstring, lines 3-8); the live scoring path is the V2 engine in scoring/engine.py. Refactoring the legacy module won't affect current behavior, so I'd recommend closing. If you're interested in scoring, the V2 engine in scoring/ is where new work lands.

@Stanzin7 Stanzin7 closed this Jun 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants