-
Notifications
You must be signed in to change notification settings - Fork 0
[Query Create]: #1
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Target Language
python
Query Name (Optional)
Bare Except
Query Type
Code Quality
Query Description
Bare except: (overly broad exception handling)
Why it’s a quality problem
Catching everything (including KeyboardInterrupt, SystemExit, etc.) can:
hide real bugs,
make failures harder to debug,
lead to incorrect behavior by swallowing critical exceptions.
Expected Severity
Medium
Code Examples
//should be detected
def parse_int(s: str) -> int:
try:
return int(s)
except: # <- too broad
return 0
//should NOT be detected
def parse_int(s: str) -> int:
try:
return int(s)
except ValueError:
return 0
CWE/CVE Reference (Optional)
No response
References (Optional)
No response
Code of Conduct
- I agree to follow this project's Code of Conduct
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request