Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR improves code quality by removing unused imports, making exception handling more specific, and standardizing generator return behavior.
Key Changes:
- Removed unused
timeimport fromenrich_code_scanning_alerts.py - Replaced bare
except:clause with specific exception types - Modified generator functions to explicitly yield and return
None
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| list_secret_scanning_alerts.py | Refactored generator function to explicitly yield alerts and return None instead of returning the generator directly, improving consistency between raw and processed output paths |
| enrich_code_scanning_alerts.py | Removed unused time import and replaced bare except: with specific exception types for better error handling |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| rule_metadata["security-severity"] | ||
| ) | ||
| except: | ||
| except (FloatingPointError, ValueError): |
There was a problem hiding this comment.
FloatingPointError is not the appropriate exception to catch here. The float() function raises ValueError when it cannot parse the input string, not FloatingPointError. FloatingPointError is only raised during floating-point arithmetic operations (like division by zero with floating-point numbers), not during string-to-float conversion. The correct exception handling should be except ValueError: only.
| except (FloatingPointError, ValueError): | |
| except ValueError: |
No description provided.