You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class Dependency:
def validate(self) -> bool:
raise ValueError(f"""Must provide a value for argument '{self.argument}' if {self.mode.__name__} of: {", ".join(f"'{arg}'" for arg in self.arguments)} are truthy.""")
error:
error: Autofix introduced a syntax error. Reverting all changes.
This indicates a bug in `ruff`. If you could open an issue at:
https://github.com/astral-sh/ruff/issues/new?title=%5BAutofix%20error%5D
...quoting the contents of `iohandler8090.py`, the rule codes EM102, along with the `pyproject.toml` settings and executed command, we'd be very appreciative!
iohandler8090.py:1:1: D100 Missing docstring in public module
iohandler8090.py:1:1: CPY001 Missing copyright notice at top of file
iohandler8090.py:1:7: D101 Missing docstring in public class
iohandler8090.py:2:9: D102 Missing docstring in public method
iohandler8090.py:2:18: ANN101 Missing type annotation for `self` in method
iohandler8090.py:3:1: E117 Over-indented
iohandler8090.py:3:23: TRY003 Avoid specifying long messages outside the exception class
iohandler8090.py:3:34: EM102 Exception must not use an f-string literal, assign to variable first
iohandler8090.py:3:89: E501 Line too long (182 > 88 characters)
## Summary
This PR fixes the bug where the generated fix for `EM*` rules would
replace a
triple-quoted (f-)string with a single-quoted (f-)string. This changes
the
semantic of the string in case it contains a single-quoted string
literal. This
is especially evident with f-strings where the expression could contain
another
string within it. For example,
```python
f"""normal {"another"} normal"""
```
## Test Plan
Add test case for triple-quoted string and update the snapshots.
fixes: #6988fixes: #7736
Ruff 0.0.286 (latest changes from main branch)
file content:
error:
iohandler8090.py.zip
The text was updated successfully, but these errors were encountered: