aboutcode-org / aboutcode-org/vulnerablecode

fix: Replace bare [except] (vulnerabilities/tests/test_bare_except_fix.py) with explicit `Exception` in import_runner.py

Open
#2,070 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
702
Forks
328
Avg merge
3d 8h
Merged PRs (30d)
3

Description

## Summary

The file [vulnerabilities/import_runner.py] contains a bare `except:` clause at line 222 which violates PEP 8 (E722) and can lead to unexpected behavior.

## Problem

Bare `except:` clauses catch **all** exceptions, including:
- `SystemExit` - prevents clean program termination
- `KeyboardInterrupt` - prevents Ctrl+C from working
- `GeneratorExit` - can break generator cleanup

This is almost never the intended behavior and can mask critical errors or make debugging difficult.

## Location

**File:** [vulnerabilities/import_runner.py](cci:7://file:///D:/Projects2.0/Gsoc/vulnerablecode/vulnerabilities/import_runner.py:0:0-0:0)
**Line:** 222
**Current code:**
```python
except:
logger.error(
f"Failed to create VulnerabilitySeverity for: {severity} with error:\n{traceback_format_exc()}"
)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.