Created
January 27, 2026 21:42
-
-
Save rexwhitten/c9e3587ead03ac0c2c652674ac7588c8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def apply_scoring(scoring_strategy, findings): | |
| # Assuming logger is defined globally or imported | |
| # logger.info("Scoring") | |
| score = 0 | |
| status = "no score" | |
| # Safety check: ensure findings is a list/iterable | |
| if findings is None: | |
| findings = [] | |
| # 1. Count Strategy: Score is simply the number of findings | |
| if scoring_strategy == "count": | |
| score = len(findings) | |
| status = "scored (count)" | |
| # 2. Strict Strategy: If any findings exist, give a maximum score (e.g., 10) | |
| elif scoring_strategy == "strict": | |
| if len(findings) > 0: | |
| score = 10 | |
| status = "scored (strict)" | |
| # 3. Default Strategy (Fallback) | |
| # Logic: If findings > 0 then score is 6, else 0 | |
| else: | |
| if len(findings) > 0: | |
| score = 6 | |
| else: | |
| score = 0 | |
| status = "scored (default)" | |
| return { | |
| "score" : score, | |
| "status" : status | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment