mypy_clean_slate
mypy_clean_slate copied to clipboard
Handle multiline statements properly
Following https://github.com/geo7/mypy_clean_slate/issues/110 it was highlighted that multiline statements aren't currently being handled correctly
Running mypy_clean_slate
on:
class Foo:
bar: dict = { # noqa: RUF012
"int": int,
}
Should result in:
class Foo:
bar: dict = { # type: ignore[type-arg] # noqa: RUF012
"int": int,
}
Currently (following https://github.com/geo7/mypy_clean_slate/issues/110 at least...) it raises a UserWarning
Some additional examples with expected (ish) results
Given:
x : list[int] = [1,
'a',
3
]; print('hm')
Want:
x : list[int] = [1,
'a', # type: ignore[list-item]
3
]; print('hm')
Given:
x : list[int] = [
1, # first element
'c', # second element
1, # third element
]
Want:
x : list[int] = [
1, # first element
'c', # type: ignore[list-item] # second element
1, # third element
]