-
Notifications
You must be signed in to change notification settings - Fork 2k
Autofix EM101 #9052
Copy link
Copy link
Closed as not planned
Labels
fixesRelated to suggested fixes for violationsRelated to suggested fixes for violations
Description
EM101: Exception must not use a string literal, assign to variable first
This seems a simple enough to auto-fix given the example
current
raise XYZ(<some-kind-of-string>)autofix to:
msg = <some-kind-of-string>
raise XYZ(msg)- if msg has been previously defined, we could still fail (with an unfixable message) (or try weird names for the variable like message, xyz_msg, xyz_message, error_msg, error_message, etc.)
Verified no autofix for:
- ruff: ruff 0.1.7
- python: 3.11
- nothing relevant to em101 in pyproject.toml (except selecting "EM")
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
fixesRelated to suggested fixes for violationsRelated to suggested fixes for violations