Avoid `E275` if keyword is followed by a semicolon (#12095)

fixes: #12094
This commit is contained in:
Dhruv Manilawala 2024-06-28 20:51:35 +05:30 committed by GitHub
parent c326778652
commit 47b227394e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 0 deletions

View File

@ -77,3 +77,6 @@ type Number = int
match(foo): match(foo):
case(1): case(1):
pass pass
# https://github.com/astral-sh/ruff/issues/12094
pass;

View File

@ -60,6 +60,7 @@ pub(crate) fn missing_whitespace_after_keyword(
|| matches!( || matches!(
tok1_kind, tok1_kind,
TokenKind::Colon TokenKind::Colon
| TokenKind::Semi
| TokenKind::Newline | TokenKind::Newline
| TokenKind::NonLogicalNewline | TokenKind::NonLogicalNewline
// In the event of a syntax error, do not attempt to add a whitespace. // In the event of a syntax error, do not attempt to add a whitespace.

View File

@ -124,6 +124,7 @@ E27.py:77:1: E275 [*] Missing whitespace after keyword
77 |+match (foo): 77 |+match (foo):
78 78 | case(1): 78 78 | case(1):
79 79 | pass 79 79 | pass
80 80 |
E27.py:78:5: E275 [*] Missing whitespace after keyword E27.py:78:5: E275 [*] Missing whitespace after keyword
| |
@ -142,3 +143,5 @@ E27.py:78:5: E275 [*] Missing whitespace after keyword
78 |- case(1): 78 |- case(1):
78 |+ case (1): 78 |+ case (1):
79 79 | pass 79 79 | pass
80 80 |
81 81 | # https://github.com/astral-sh/ruff/issues/12094