Skip to content

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

@samay2504

Description

@samay2504

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
Line: 222
Current code:

except: logger.error( f"Failed to create VulnerabilitySeverity for: {severity} with error:\n{traceback_format_exc()}" )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions