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")
EM101: Exception must not use a string literal, assign to variable first
This seems a simple enough to auto-fix given the example
current
autofix to:
Verified no autofix for: