Feels like a bug to me that this applies to type annotations. In case of dict keys it's a very nice rule to make it clear that you have a tuple key, but for type annotations it feels pretty noisy/ugly...
$ ruff version
ruff 0.5.7
$ cat test.py
bar = {}
bar[('hello', 'world')] = None
foo: tuple[str, str] | None = None
$ ruff check --isolated --select RUF031 --config 'lint.ruff.parenthesize-tuple-in-subscript = true' --preview --no-cache test.py
test.py:3:12: RUF031 [*] Use parentheses for tuples in subscripts.
|
1 | bar = {}
2 | bar[('hello', 'world')] = None
3 | foo: tuple[str, str] | None = None
| ^^^^^^^^ RUF031
|
= help: Parenthesize the tuple.
Found 1 error.
[*] 1 fixable with the `--fix` option.
``
Feels like a bug to me that this applies to type annotations. In case of dict keys it's a very nice rule to make it clear that you have a tuple key, but for type annotations it feels pretty noisy/ugly...