mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-26 20:10:09 +00:00
Avoid E231 if comma is at end-of-line (#6747)
## Summary I don't know how this could come up in valid Python, but anyway... Closes https://github.com/astral-sh/ruff/issues/6738.
This commit is contained in:
parent
37f4920e1e
commit
abc5065fc7
3 changed files with 7 additions and 2 deletions
|
@ -28,3 +28,6 @@ mdtypes_template = {
|
|||
'tag_full': [('mdtype', 'u4'), ('byte_count', 'u4')],
|
||||
'tag_smalldata':[('byte_count_mdtype', 'u4'), ('data', 'S4')],
|
||||
}
|
||||
|
||||
#: Okay
|
||||
a = (1,
|
||||
|
|
|
@ -81,10 +81,10 @@ pub(crate) fn missing_whitespace(
|
|||
TokenKind::Comma | TokenKind::Semi | TokenKind::Colon => {
|
||||
let after = line.text_after(token);
|
||||
|
||||
if !after
|
||||
if after
|
||||
.chars()
|
||||
.next()
|
||||
.is_some_and(|c| char::is_whitespace(c) || c == '\\')
|
||||
.is_some_and(|c| !(char::is_whitespace(c) || c == '\\'))
|
||||
{
|
||||
if let Some(next_token) = iter.peek() {
|
||||
match (kind, next_token.kind()) {
|
||||
|
|
|
@ -98,5 +98,7 @@ E23.py:29:20: E231 [*] Missing whitespace after ':'
|
|||
29 |- 'tag_smalldata':[('byte_count_mdtype', 'u4'), ('data', 'S4')],
|
||||
29 |+ 'tag_smalldata': [('byte_count_mdtype', 'u4'), ('data', 'S4')],
|
||||
30 30 | }
|
||||
31 31 |
|
||||
32 32 | #: Okay
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue