Skip to content

Request: autofix for EM102 with msg #4103

@jamesbraza

Description

@jamesbraza
some_string = "ruff"
raise ValueError(f"Hello {some_string}.")

Running with ruff==0.0.263:

> ruff --fixable=EM102 --fix --select=EM102 a.py
a.py:2:18: EM102 Exception must not use an f-string literal, assign to variable first
Found 1 error.

It would be nice if EM102 supported autofix with msg like the rule explanation so:

some_string = "ruff"
msg = f"Hello {some_string}."
raise ValueError(msg)

Metadata

Metadata

Assignees

Labels

fixesRelated to suggested fixes for violations

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions