diff --git a/crates/ruff/src/rules/pycodestyle/rules/logical_lines/extraneous_whitespace.rs b/crates/ruff/src/rules/pycodestyle/rules/logical_lines/extraneous_whitespace.rs index 96e5a2a580..53fd590e5c 100644 --- a/crates/ruff/src/rules/pycodestyle/rules/logical_lines/extraneous_whitespace.rs +++ b/crates/ruff/src/rules/pycodestyle/rules/logical_lines/extraneous_whitespace.rs @@ -109,8 +109,12 @@ pub(crate) fn extraneous_whitespace(line: &LogicalLine, context: &mut LogicalLin let kind = token.kind(); match kind { TokenKind::Lbrace | TokenKind::Lpar | TokenKind::Lsqb => { - if !matches!(line.trailing_whitespace(token), Whitespace::None) { - context.push(WhitespaceAfterOpenBracket, TextRange::empty(token.end())); + let (trailing, trailing_len) = line.trailing_whitespace(token); + if !matches!(trailing, Whitespace::None) { + context.push( + WhitespaceAfterOpenBracket, + TextRange::at(token.end(), trailing_len), + ); } } TokenKind::Rbrace @@ -119,10 +123,10 @@ pub(crate) fn extraneous_whitespace(line: &LogicalLine, context: &mut LogicalLin | TokenKind::Comma | TokenKind::Semi | TokenKind::Colon => { - if let (Whitespace::Single | Whitespace::Many | Whitespace::Tab, offset) = - line.leading_whitespace(token) - { - if !matches!(last_token, TokenKind::Comma | TokenKind::EndOfFile) { + if !matches!(last_token, TokenKind::Comma | TokenKind::EndOfFile) { + if let (Whitespace::Single | Whitespace::Many | Whitespace::Tab, offset) = + line.leading_whitespace(token) + { let diagnostic_kind = if matches!( kind, TokenKind::Comma | TokenKind::Semi | TokenKind::Colon @@ -132,7 +136,10 @@ pub(crate) fn extraneous_whitespace(line: &LogicalLine, context: &mut LogicalLin DiagnosticKind::from(WhitespaceBeforeCloseBracket) }; - context.push(diagnostic_kind, TextRange::empty(token.start() - offset)); + context.push( + diagnostic_kind, + TextRange::at(token.start() - offset, offset), + ); } } } diff --git a/crates/ruff/src/rules/pycodestyle/rules/logical_lines/missing_whitespace.rs b/crates/ruff/src/rules/pycodestyle/rules/logical_lines/missing_whitespace.rs index ca635b9a8e..823def692d 100644 --- a/crates/ruff/src/rules/pycodestyle/rules/logical_lines/missing_whitespace.rs +++ b/crates/ruff/src/rules/pycodestyle/rules/logical_lines/missing_whitespace.rs @@ -4,7 +4,7 @@ use ruff_diagnostics::Edit; use ruff_diagnostics::{AlwaysAutofixableViolation, Diagnostic, Fix}; use ruff_macros::{derive_message_formats, violation}; use ruff_python_ast::token_kind::TokenKind; -use ruff_text_size::{TextRange, TextSize}; +use ruff_text_size::TextSize; #[violation] pub struct MissingWhitespace { @@ -82,8 +82,7 @@ pub(crate) fn missing_whitespace( } let kind = MissingWhitespace { token: kind }; - - let mut diagnostic = Diagnostic::new(kind, TextRange::empty(token.start())); + let mut diagnostic = Diagnostic::new(kind, token.range()); if autofix { #[allow(deprecated)] diff --git a/crates/ruff/src/rules/pycodestyle/rules/logical_lines/missing_whitespace_after_keyword.rs b/crates/ruff/src/rules/pycodestyle/rules/logical_lines/missing_whitespace_after_keyword.rs index 6460713f55..9ad7878512 100644 --- a/crates/ruff/src/rules/pycodestyle/rules/logical_lines/missing_whitespace_after_keyword.rs +++ b/crates/ruff/src/rules/pycodestyle/rules/logical_lines/missing_whitespace_after_keyword.rs @@ -3,7 +3,6 @@ use crate::rules::pycodestyle::rules::logical_lines::LogicalLine; use ruff_diagnostics::Violation; use ruff_macros::{derive_message_formats, violation}; use ruff_python_ast::token_kind::TokenKind; -use ruff_text_size::TextRange; #[violation] pub struct MissingWhitespaceAfterKeyword; @@ -35,7 +34,7 @@ pub(crate) fn missing_whitespace_after_keyword( || matches!(tok1_kind, TokenKind::Colon | TokenKind::Newline)) && tok0.end() == tok1.start() { - context.push(MissingWhitespaceAfterKeyword, TextRange::empty(tok0.end())); + context.push(MissingWhitespaceAfterKeyword, tok0.range()); } } } diff --git a/crates/ruff/src/rules/pycodestyle/rules/logical_lines/missing_whitespace_around_operator.rs b/crates/ruff/src/rules/pycodestyle/rules/logical_lines/missing_whitespace_around_operator.rs index 5200a8bdf5..4a77d86a6a 100644 --- a/crates/ruff/src/rules/pycodestyle/rules/logical_lines/missing_whitespace_around_operator.rs +++ b/crates/ruff/src/rules/pycodestyle/rules/logical_lines/missing_whitespace_around_operator.rs @@ -3,7 +3,6 @@ use crate::rules::pycodestyle::rules::logical_lines::{LogicalLine, LogicalLineTo use ruff_diagnostics::{DiagnosticKind, Violation}; use ruff_macros::{derive_message_formats, violation}; use ruff_python_ast::token_kind::TokenKind; -use ruff_text_size::TextRange; // E225 #[violation] @@ -129,30 +128,20 @@ pub(crate) fn missing_whitespace_around_operator( match (has_leading_trivia, has_trailing_trivia) { // Operator with trailing but no leading space, enforce consistent spacing - (false, true) => { - context.push( - MissingWhitespaceAroundOperator, - TextRange::empty(token.start()), - ); - } + (false, true) | // Operator with leading but no trailing space, enforce consistent spacing. - (true, false) => { - context.push( - MissingWhitespaceAroundOperator, - TextRange::empty(token.end()), - ); + (true, false) + => { + context.push(MissingWhitespaceAroundOperator, token.range()); } // Operator with no space, require spaces if it is required by the operator. (false, false) => { if needs_space == NeedsSpace::Yes { - context.push( - diagnostic_kind_for_operator(kind), - TextRange::empty(token.start()), - ); + context.push(diagnostic_kind_for_operator(kind), token.range()); } } (true, true) => { - // Operator has leading and trailing space, all good + // Operator has leading and trailing spaces, all good } } } diff --git a/crates/ruff/src/rules/pycodestyle/rules/logical_lines/mod.rs b/crates/ruff/src/rules/pycodestyle/rules/logical_lines/mod.rs index b98aeceaf2..94d07ed9ff 100644 --- a/crates/ruff/src/rules/pycodestyle/rules/logical_lines/mod.rs +++ b/crates/ruff/src/rules/pycodestyle/rules/logical_lines/mod.rs @@ -240,8 +240,8 @@ impl<'a> LogicalLine<'a> { .slice(TextRange::new(first_token.start(), token.start())) } - /// Returns the whitespace *after* the `token` - pub fn trailing_whitespace(&self, token: &'a LogicalLineToken) -> Whitespace { + /// Returns the whitespace *after* the `token` with the byte length + pub fn trailing_whitespace(&self, token: &'a LogicalLineToken) -> (Whitespace, TextSize) { Whitespace::leading(self.text_after(token)) } @@ -358,35 +358,45 @@ pub(crate) enum Whitespace { } impl Whitespace { - fn leading(content: &str) -> Self { + fn leading(content: &str) -> (Self, TextSize) { let mut count = 0u32; + let mut len = TextSize::default(); + let mut has_tabs = false; for c in content.chars() { if c == '\t' { - return Self::Tab; + has_tabs = true; + len += c.text_len(); } else if matches!(c, '\n' | '\r') { break; } else if c.is_whitespace() { count += 1; + len += c.text_len(); } else { break; } } - match count { - 0 => Whitespace::None, - 1 => Whitespace::Single, - _ => Whitespace::Many, + if has_tabs { + (Whitespace::Tab, len) + } else { + match count { + 0 => (Whitespace::None, len), + 1 => (Whitespace::Single, len), + _ => (Whitespace::Many, len), + } } } fn trailing(content: &str) -> (Self, TextSize) { let mut len = TextSize::default(); let mut count = 0usize; + let mut has_tabs = false; for c in content.chars().rev() { if c == '\t' { - return (Self::Tab, len + c.text_len()); + has_tabs = true; + len += c.text_len(); } else if matches!(c, '\n' | '\r') { // Indent return (Self::None, TextSize::default()); @@ -398,15 +408,19 @@ impl Whitespace { } } - match count { - 0 => (Self::None, TextSize::default()), - 1 => (Self::Single, len), - _ => { - if len == content.text_len() { - // All whitespace up to the start of the line -> Indent - (Self::None, TextSize::default()) - } else { - (Self::Many, len) + if has_tabs { + (Self::Tab, len) + } else { + match count { + 0 => (Self::None, TextSize::default()), + 1 => (Self::Single, len), + _ => { + if len == content.text_len() { + // All whitespace up to the start of the line -> Indent + (Self::None, TextSize::default()) + } else { + (Self::Many, len) + } } } } diff --git a/crates/ruff/src/rules/pycodestyle/rules/logical_lines/space_around_operator.rs b/crates/ruff/src/rules/pycodestyle/rules/logical_lines/space_around_operator.rs index e3cba4c894..beb2e9552e 100644 --- a/crates/ruff/src/rules/pycodestyle/rules/logical_lines/space_around_operator.rs +++ b/crates/ruff/src/rules/pycodestyle/rules/logical_lines/space_around_operator.rs @@ -133,14 +133,15 @@ pub(crate) fn space_around_operator(line: &LogicalLine, context: &mut LogicalLin if !after_operator { match line.leading_whitespace(token) { (Whitespace::Tab, offset) => { - let start = token.start(); - context.push(TabBeforeOperator, TextRange::empty(start - offset)); + context.push( + TabBeforeOperator, + TextRange::at(token.start() - offset, offset), + ); } (Whitespace::Many, offset) => { - let start = token.start(); context.push( MultipleSpacesBeforeOperator, - TextRange::empty(start - offset), + TextRange::at(token.start() - offset, offset), ); } _ => {} @@ -148,13 +149,11 @@ pub(crate) fn space_around_operator(line: &LogicalLine, context: &mut LogicalLin } match line.trailing_whitespace(token) { - Whitespace::Tab => { - let end = token.end(); - context.push(TabAfterOperator, TextRange::empty(end)); + (Whitespace::Tab, len) => { + context.push(TabAfterOperator, TextRange::at(token.end(), len)); } - Whitespace::Many => { - let end = token.end(); - context.push(MultipleSpacesAfterOperator, TextRange::empty(end)); + (Whitespace::Many, len) => { + context.push(MultipleSpacesAfterOperator, TextRange::at(token.end(), len)); } _ => {} } diff --git a/crates/ruff/src/rules/pycodestyle/rules/logical_lines/whitespace_around_keywords.rs b/crates/ruff/src/rules/pycodestyle/rules/logical_lines/whitespace_around_keywords.rs index 121fee2659..a181c925a8 100644 --- a/crates/ruff/src/rules/pycodestyle/rules/logical_lines/whitespace_around_keywords.rs +++ b/crates/ruff/src/rules/pycodestyle/rules/logical_lines/whitespace_around_keywords.rs @@ -118,13 +118,13 @@ pub(crate) fn whitespace_around_keywords(line: &LogicalLine, context: &mut Logic match line.leading_whitespace(token) { (Whitespace::Tab, offset) => { let start = token.start(); - context.push(TabBeforeKeyword, TextRange::empty(start - offset)); + context.push(TabBeforeKeyword, TextRange::at(start - offset, offset)); } (Whitespace::Many, offset) => { let start = token.start(); context.push( MultipleSpacesBeforeKeyword, - TextRange::empty(start - offset), + TextRange::at(start - offset, offset), ); } _ => {} @@ -132,13 +132,11 @@ pub(crate) fn whitespace_around_keywords(line: &LogicalLine, context: &mut Logic } match line.trailing_whitespace(token) { - Whitespace::Tab => { - let end = token.end(); - context.push(TabAfterKeyword, TextRange::empty(end)); + (Whitespace::Tab, len) => { + context.push(TabAfterKeyword, TextRange::at(token.end(), len)); } - Whitespace::Many => { - let end = token.end(); - context.push(MultipleSpacesAfterKeyword, TextRange::empty(end)); + (Whitespace::Many, len) => { + context.push(MultipleSpacesAfterKeyword, TextRange::at(token.end(), len)); } _ => {} } diff --git a/crates/ruff/src/rules/pycodestyle/rules/logical_lines/whitespace_around_named_parameter_equals.rs b/crates/ruff/src/rules/pycodestyle/rules/logical_lines/whitespace_around_named_parameter_equals.rs index bf104e7179..935373c726 100644 --- a/crates/ruff/src/rules/pycodestyle/rules/logical_lines/whitespace_around_named_parameter_equals.rs +++ b/crates/ruff/src/rules/pycodestyle/rules/logical_lines/whitespace_around_named_parameter_equals.rs @@ -78,10 +78,7 @@ pub(crate) fn whitespace_around_named_parameter_equals( if annotated_func_arg && parens == 1 { let start = token.start(); if start == prev_end && prev_end != TextSize::new(0) { - context.push( - MissingWhitespaceAroundParameterEquals, - TextRange::empty(start), - ); + context.push(MissingWhitespaceAroundParameterEquals, token.range()); } while let Some(next) = iter.peek() { @@ -91,10 +88,7 @@ pub(crate) fn whitespace_around_named_parameter_equals( let next_start = next.start(); if next_start == token.end() { - context.push( - MissingWhitespaceAroundParameterEquals, - TextRange::empty(next_start), - ); + context.push(MissingWhitespaceAroundParameterEquals, token.range()); } break; } @@ -103,7 +97,7 @@ pub(crate) fn whitespace_around_named_parameter_equals( if token.start() != prev_end { context.push( UnexpectedSpacesAroundKeywordParameterEquals, - TextRange::empty(prev_end), + TextRange::new(prev_end, token.start()), ); } @@ -114,7 +108,7 @@ pub(crate) fn whitespace_around_named_parameter_equals( if next.start() != token.end() { context.push( UnexpectedSpacesAroundKeywordParameterEquals, - TextRange::empty(token.end()), + TextRange::new(token.end(), next.start()), ); } break; diff --git a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E201_E20.py.snap b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E201_E20.py.snap index 2308d50890..35e6582c5a 100644 --- a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E201_E20.py.snap +++ b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E201_E20.py.snap @@ -5,7 +5,7 @@ E20.py:2:6: E201 Whitespace after '(' | 2 | #: E201:1:6 3 | spam( ham[1], {eggs: 2}) - | E201 + | ^ E201 4 | #: E201:1:10 5 | spam(ham[ 1], {eggs: 2}) | @@ -15,7 +15,7 @@ E20.py:4:10: E201 Whitespace after '(' 4 | spam( ham[1], {eggs: 2}) 5 | #: E201:1:10 6 | spam(ham[ 1], {eggs: 2}) - | E201 + | ^ E201 7 | #: E201:1:15 8 | spam(ham[1], { eggs: 2}) | @@ -25,7 +25,7 @@ E20.py:6:15: E201 Whitespace after '(' 6 | spam(ham[ 1], {eggs: 2}) 7 | #: E201:1:15 8 | spam(ham[1], { eggs: 2}) - | E201 + | ^ E201 9 | #: E201:1:6 10 | spam( ham[1], {eggs: 2}) | @@ -35,7 +35,7 @@ E20.py:8:6: E201 Whitespace after '(' 8 | spam(ham[1], { eggs: 2}) 9 | #: E201:1:6 10 | spam( ham[1], {eggs: 2}) - | E201 + | ^^^ E201 11 | #: E201:1:10 12 | spam(ham[ 1], {eggs: 2}) | @@ -45,7 +45,7 @@ E20.py:10:10: E201 Whitespace after '(' 10 | spam( ham[1], {eggs: 2}) 11 | #: E201:1:10 12 | spam(ham[ 1], {eggs: 2}) - | E201 + | ^^^ E201 13 | #: E201:1:15 14 | spam(ham[1], { eggs: 2}) | @@ -55,7 +55,7 @@ E20.py:12:15: E201 Whitespace after '(' 12 | spam(ham[ 1], {eggs: 2}) 13 | #: E201:1:15 14 | spam(ham[1], { eggs: 2}) - | E201 + | ^^ E201 15 | #: Okay 16 | spam(ham[1], {eggs: 2}) | diff --git a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E202_E20.py.snap b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E202_E20.py.snap index 69edd156d1..6718126843 100644 --- a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E202_E20.py.snap +++ b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E202_E20.py.snap @@ -5,7 +5,7 @@ E20.py:19:23: E202 Whitespace before ')' | 19 | #: E202:1:23 20 | spam(ham[1], {eggs: 2} ) - | E202 + | ^ E202 21 | #: E202:1:22 22 | spam(ham[1], {eggs: 2 }) | @@ -15,7 +15,7 @@ E20.py:21:22: E202 Whitespace before ')' 21 | spam(ham[1], {eggs: 2} ) 22 | #: E202:1:22 23 | spam(ham[1], {eggs: 2 }) - | E202 + | ^ E202 24 | #: E202:1:11 25 | spam(ham[1 ], {eggs: 2}) | @@ -25,7 +25,7 @@ E20.py:23:11: E202 Whitespace before ')' 23 | spam(ham[1], {eggs: 2 }) 24 | #: E202:1:11 25 | spam(ham[1 ], {eggs: 2}) - | E202 + | ^ E202 26 | #: E202:1:23 27 | spam(ham[1], {eggs: 2} ) | @@ -35,7 +35,7 @@ E20.py:25:23: E202 Whitespace before ')' 25 | spam(ham[1 ], {eggs: 2}) 26 | #: E202:1:23 27 | spam(ham[1], {eggs: 2} ) - | E202 + | ^^ E202 28 | #: E202:1:22 29 | spam(ham[1], {eggs: 2 }) | @@ -45,7 +45,7 @@ E20.py:27:22: E202 Whitespace before ')' 27 | spam(ham[1], {eggs: 2} ) 28 | #: E202:1:22 29 | spam(ham[1], {eggs: 2 }) - | E202 + | ^^^ E202 30 | #: E202:1:11 31 | spam(ham[1 ], {eggs: 2}) | @@ -55,7 +55,7 @@ E20.py:29:11: E202 Whitespace before ')' 29 | spam(ham[1], {eggs: 2 }) 30 | #: E202:1:11 31 | spam(ham[1 ], {eggs: 2}) - | E202 + | ^^ E202 32 | #: Okay 33 | spam(ham[1], {eggs: 2}) | diff --git a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E203_E20.py.snap b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E203_E20.py.snap index de37bc5aaf..c50b975ad4 100644 --- a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E203_E20.py.snap +++ b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E203_E20.py.snap @@ -5,7 +5,7 @@ E20.py:51:10: E203 Whitespace before ',', ';', or ':' | 51 | #: E203:1:10 52 | if x == 4 : - | E203 + | ^ E203 53 | print x, y 54 | x, y = y, x | @@ -15,7 +15,7 @@ E20.py:55:10: E203 Whitespace before ',', ';', or ':' 55 | x, y = y, x 56 | #: E203:1:10 57 | if x == 4 : - | E203 + | ^^^ E203 58 | print x, y 59 | x, y = y, x | @@ -25,7 +25,7 @@ E20.py:60:15: E203 Whitespace before ',', ';', or ':' 60 | #: E203:2:15 E702:2:16 61 | if x == 4: 62 | print x, y ; x, y = y, x - | E203 + | ^ E203 63 | #: E203:2:15 E702:2:16 64 | if x == 4: | @@ -35,7 +35,7 @@ E20.py:63:15: E203 Whitespace before ',', ';', or ':' 63 | #: E203:2:15 E702:2:16 64 | if x == 4: 65 | print x, y ; x, y = y, x - | E203 + | ^^ E203 66 | #: E203:3:13 67 | if x == 4: | @@ -45,7 +45,7 @@ E20.py:67:13: E203 Whitespace before ',', ';', or ':' 67 | if x == 4: 68 | print x, y 69 | x, y = y , x - | E203 + | ^ E203 70 | #: E203:3:13 71 | if x == 4: | @@ -55,7 +55,7 @@ E20.py:71:13: E203 Whitespace before ',', ';', or ':' 71 | if x == 4: 72 | print x, y 73 | x, y = y , x - | E203 + | ^^^^ E203 74 | #: Okay 75 | if x == 4: | diff --git a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E221_E22.py.snap b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E221_E22.py.snap index 2dd5e63fd6..29c9bad92e 100644 --- a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E221_E22.py.snap +++ b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E221_E22.py.snap @@ -6,7 +6,7 @@ E22.py:3:6: E221 Multiple spaces before operator 3 | #: E221 4 | a = 12 + 3 5 | b = 4 + 5 - | E221 + | ^^ E221 6 | #: E221 E221 7 | x = 1 | @@ -16,7 +16,7 @@ E22.py:5:2: E221 Multiple spaces before operator 5 | b = 4 + 5 6 | #: E221 E221 7 | x = 1 - | E221 + | ^^^^^^^^^^^^^ E221 8 | y = 2 9 | long_variable = 3 | @@ -26,7 +26,7 @@ E22.py:6:2: E221 Multiple spaces before operator 6 | #: E221 E221 7 | x = 1 8 | y = 2 - | E221 + | ^^^^^^^^^^^^^ E221 9 | long_variable = 3 10 | #: E221 E221 | @@ -36,7 +36,7 @@ E22.py:9:5: E221 Multiple spaces before operator 9 | long_variable = 3 10 | #: E221 E221 11 | x[0] = 1 - | E221 + | ^^^^^^^^^^ E221 12 | x[1] = 2 13 | long_variable = 3 | @@ -46,7 +46,7 @@ E22.py:10:5: E221 Multiple spaces before operator 10 | #: E221 E221 11 | x[0] = 1 12 | x[1] = 2 - | E221 + | ^^^^^^^^^^ E221 13 | long_variable = 3 14 | #: E221 E221 | @@ -56,7 +56,7 @@ E22.py:13:9: E221 Multiple spaces before operator 13 | long_variable = 3 14 | #: E221 E221 15 | x = f(x) + 1 - | E221 + | ^^^^^^^^^^ E221 16 | y = long_variable + 2 17 | z = x[0] + 3 | @@ -66,7 +66,7 @@ E22.py:15:9: E221 Multiple spaces before operator 15 | x = f(x) + 1 16 | y = long_variable + 2 17 | z = x[0] + 3 - | E221 + | ^^^^^^^^^^ E221 18 | #: E221:3:14 19 | text = """ | @@ -76,7 +76,7 @@ E22.py:19:14: E221 Multiple spaces before operator 19 | text = """ 20 | bar 21 | foo %s""" % rofl - | E221 + | ^^ E221 22 | #: Okay 23 | x = 1 | diff --git a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E222_E22.py.snap b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E222_E22.py.snap index e3e4d8d9ae..0f4ded92a7 100644 --- a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E222_E22.py.snap +++ b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E222_E22.py.snap @@ -5,7 +5,7 @@ E22.py:28:8: E222 Multiple spaces after operator | 28 | #: E222 29 | a = a + 1 - | E222 + | ^^ E222 30 | b = b + 10 31 | #: E222 E222 | @@ -15,7 +15,7 @@ E22.py:31:4: E222 Multiple spaces after operator 31 | b = b + 10 32 | #: E222 E222 33 | x = -1 - | E222 + | ^^^^^^^^^^^^ E222 34 | y = -2 35 | long_variable = 3 | @@ -25,7 +25,7 @@ E22.py:32:4: E222 Multiple spaces after operator 32 | #: E222 E222 33 | x = -1 34 | y = -2 - | E222 + | ^^^^^^^^^^^^ E222 35 | long_variable = 3 36 | #: E222 E222 | @@ -35,7 +35,7 @@ E22.py:35:7: E222 Multiple spaces after operator 35 | long_variable = 3 36 | #: E222 E222 37 | x[0] = 1 - | E222 + | ^^^^^^^^^^ E222 38 | x[1] = 2 39 | long_variable = 3 | @@ -45,7 +45,7 @@ E22.py:36:7: E222 Multiple spaces after operator 36 | #: E222 E222 37 | x[0] = 1 38 | x[1] = 2 - | E222 + | ^^^^^^^^^^ E222 39 | long_variable = 3 40 | #: | diff --git a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E223_E22.py.snap b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E223_E22.py.snap index 0235b13891..9fa7c5bfa3 100644 --- a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E223_E22.py.snap +++ b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E223_E22.py.snap @@ -6,7 +6,7 @@ E22.py:43:2: E223 Tab before operator 43 | #: E223 44 | foobart = 4 45 | a = 3 # aligned with tab - | E223 + | ^^^ E223 46 | #: | diff --git a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E224_E22.py.snap b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E224_E22.py.snap index a8344802ea..a6a0b44367 100644 --- a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E224_E22.py.snap +++ b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E224_E22.py.snap @@ -5,7 +5,7 @@ E22.py:48:5: E224 Tab after operator | 48 | #: E224 49 | a += 1 - | E224 + | ^^^^ E224 50 | b += 1000 51 | #: | diff --git a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E225_E22.py.snap b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E225_E22.py.snap index 61728196aa..9d84cd4431 100644 --- a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E225_E22.py.snap +++ b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E225_E22.py.snap @@ -1,11 +1,11 @@ --- source: crates/ruff/src/rules/pycodestyle/mod.rs --- -E22.py:54:13: E225 Missing whitespace around operator +E22.py:54:11: E225 Missing whitespace around operator | 54 | #: E225 55 | submitted +=1 - | E225 + | ^^ E225 56 | #: E225 57 | submitted+= 1 | @@ -15,37 +15,37 @@ E22.py:56:10: E225 Missing whitespace around operator 56 | submitted +=1 57 | #: E225 58 | submitted+= 1 - | E225 + | ^^ E225 59 | #: E225 60 | c =-1 | -E22.py:58:4: E225 Missing whitespace around operator +E22.py:58:3: E225 Missing whitespace around operator | 58 | submitted+= 1 59 | #: E225 60 | c =-1 - | E225 + | ^ E225 61 | #: E225 62 | x = x /2 - 1 | -E22.py:60:8: E225 Missing whitespace around operator +E22.py:60:7: E225 Missing whitespace around operator | 60 | c =-1 61 | #: E225 62 | x = x /2 - 1 - | E225 + | ^ E225 63 | #: E225 64 | c = alpha -4 | -E22.py:62:12: E225 Missing whitespace around operator +E22.py:62:11: E225 Missing whitespace around operator | 62 | x = x /2 - 1 63 | #: E225 64 | c = alpha -4 - | E225 + | ^ E225 65 | #: E225 66 | c = alpha- 4 | @@ -55,27 +55,27 @@ E22.py:64:10: E225 Missing whitespace around operator 64 | c = alpha -4 65 | #: E225 66 | c = alpha- 4 - | E225 + | ^ E225 67 | #: E225 68 | z = x **y | -E22.py:66:9: E225 Missing whitespace around operator +E22.py:66:7: E225 Missing whitespace around operator | 66 | c = alpha- 4 67 | #: E225 68 | z = x **y - | E225 + | ^^ E225 69 | #: E225 70 | z = (x + 1) **y | -E22.py:68:15: E225 Missing whitespace around operator +E22.py:68:13: E225 Missing whitespace around operator | 68 | z = x **y 69 | #: E225 70 | z = (x + 1) **y - | E225 + | ^^ E225 71 | #: E225 72 | z = (x + 1)** y | @@ -85,17 +85,17 @@ E22.py:70:12: E225 Missing whitespace around operator 70 | z = (x + 1) **y 71 | #: E225 72 | z = (x + 1)** y - | E225 + | ^^ E225 73 | #: E225 74 | _1kB = _1MB >>10 | -E22.py:72:15: E225 Missing whitespace around operator +E22.py:72:13: E225 Missing whitespace around operator | 72 | z = (x + 1)** y 73 | #: E225 74 | _1kB = _1MB >>10 - | E225 + | ^^ E225 75 | #: E225 76 | _1kB = _1MB>> 10 | @@ -105,7 +105,7 @@ E22.py:74:12: E225 Missing whitespace around operator 74 | _1kB = _1MB >>10 75 | #: E225 76 | _1kB = _1MB>> 10 - | E225 + | ^^ E225 77 | #: E225 E225 78 | i=i+ 1 | @@ -115,7 +115,7 @@ E22.py:76:2: E225 Missing whitespace around operator 76 | _1kB = _1MB>> 10 77 | #: E225 E225 78 | i=i+ 1 - | E225 + | ^ E225 79 | #: E225 E225 80 | i=i +1 | @@ -125,7 +125,7 @@ E22.py:76:4: E225 Missing whitespace around operator 76 | _1kB = _1MB>> 10 77 | #: E225 E225 78 | i=i+ 1 - | E225 + | ^ E225 79 | #: E225 E225 80 | i=i +1 | @@ -135,17 +135,17 @@ E22.py:78:2: E225 Missing whitespace around operator 78 | i=i+ 1 79 | #: E225 E225 80 | i=i +1 - | E225 + | ^ E225 81 | #: E225 82 | i = 1and 1 | -E22.py:78:6: E225 Missing whitespace around operator +E22.py:78:5: E225 Missing whitespace around operator | 78 | i=i+ 1 79 | #: E225 E225 80 | i=i +1 - | E225 + | ^ E225 81 | #: E225 82 | i = 1and 1 | @@ -155,7 +155,7 @@ E22.py:80:6: E225 Missing whitespace around operator 80 | i=i +1 81 | #: E225 82 | i = 1and 1 - | E225 + | ^^^ E225 83 | #: E225 84 | i = 1or 0 | @@ -165,7 +165,7 @@ E22.py:82:6: E225 Missing whitespace around operator 82 | i = 1and 1 83 | #: E225 84 | i = 1or 0 - | E225 + | ^^ E225 85 | #: E225 86 | 1is 1 | @@ -175,7 +175,7 @@ E22.py:84:2: E225 Missing whitespace around operator 84 | i = 1or 0 85 | #: E225 86 | 1is 1 - | E225 + | ^^ E225 87 | #: E225 88 | 1in [] | @@ -185,17 +185,17 @@ E22.py:86:2: E225 Missing whitespace around operator 86 | 1is 1 87 | #: E225 88 | 1in [] - | E225 + | ^^ E225 89 | #: E225 90 | i = 1 @2 | -E22.py:88:8: E225 Missing whitespace around operator +E22.py:88:7: E225 Missing whitespace around operator | 88 | 1in [] 89 | #: E225 90 | i = 1 @2 - | E225 + | ^ E225 91 | #: E225 92 | i = 1@ 2 | @@ -205,7 +205,7 @@ E22.py:90:6: E225 Missing whitespace around operator 90 | i = 1 @2 91 | #: E225 92 | i = 1@ 2 - | E225 + | ^ E225 93 | #: E225 E226 94 | i=i+1 | @@ -215,17 +215,17 @@ E22.py:92:2: E225 Missing whitespace around operator 92 | i = 1@ 2 93 | #: E225 E226 94 | i=i+1 - | E225 + | ^ E225 95 | #: E225 E226 96 | i =i+1 | -E22.py:94:4: E225 Missing whitespace around operator +E22.py:94:3: E225 Missing whitespace around operator | 94 | i=i+1 95 | #: E225 E226 96 | i =i+1 - | E225 + | ^ E225 97 | #: E225 E226 98 | i= i+1 | @@ -235,17 +235,17 @@ E22.py:96:2: E225 Missing whitespace around operator 96 | i =i+1 97 | #: E225 E226 98 | i= i+1 - | E225 + | ^ E225 99 | #: E225 E226 100 | c = (a +b)*(a - b) | -E22.py:98:9: E225 Missing whitespace around operator +E22.py:98:8: E225 Missing whitespace around operator | 98 | i= i+1 99 | #: E225 E226 100 | c = (a +b)*(a - b) - | E225 + | ^ E225 101 | #: E225 E226 102 | c = (a+ b)*(a - b) | @@ -255,16 +255,16 @@ E22.py:100:7: E225 Missing whitespace around operator 100 | c = (a +b)*(a - b) 101 | #: E225 E226 102 | c = (a+ b)*(a - b) - | E225 + | ^ E225 103 | #: | -E22.py:154:13: E225 Missing whitespace around operator +E22.py:154:11: E225 Missing whitespace around operator | 154 | func2(lambda a, b=h[:], c=0: (a, b, c)) 155 | if not -5 < x < +5: 156 | print >>sys.stderr, "x is out of range." - | E225 + | ^^ E225 157 | print >> sys.stdout, "x is an integer." 158 | x = x / 2 - 1 | diff --git a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E226_E22.py.snap b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E226_E22.py.snap index 769264c53d..4a9c4abc9c 100644 --- a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E226_E22.py.snap +++ b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E226_E22.py.snap @@ -6,7 +6,7 @@ E22.py:92:4: E226 Missing whitespace around arithmetic operator 92 | i = 1@ 2 93 | #: E225 E226 94 | i=i+1 - | E226 + | ^ E226 95 | #: E225 E226 96 | i =i+1 | @@ -16,7 +16,7 @@ E22.py:94:5: E226 Missing whitespace around arithmetic operator 94 | i=i+1 95 | #: E225 E226 96 | i =i+1 - | E226 + | ^ E226 97 | #: E225 E226 98 | i= i+1 | @@ -26,7 +26,7 @@ E22.py:96:5: E226 Missing whitespace around arithmetic operator 96 | i =i+1 97 | #: E225 E226 98 | i= i+1 - | E226 + | ^ E226 99 | #: E225 E226 100 | c = (a +b)*(a - b) | @@ -36,7 +36,7 @@ E22.py:98:11: E226 Missing whitespace around arithmetic operator 98 | i= i+1 99 | #: E225 E226 100 | c = (a +b)*(a - b) - | E226 + | ^ E226 101 | #: E225 E226 102 | c = (a+ b)*(a - b) | @@ -46,7 +46,7 @@ E22.py:100:11: E226 Missing whitespace around arithmetic operator 100 | c = (a +b)*(a - b) 101 | #: E225 E226 102 | c = (a+ b)*(a - b) - | E226 + | ^ E226 103 | #: | @@ -54,7 +54,7 @@ E22.py:104:6: E226 Missing whitespace around arithmetic operator | 104 | #: E226 105 | z = 2//30 - | E226 + | ^^ E226 106 | #: E226 E226 107 | c = (a+b) * (a-b) | @@ -64,7 +64,7 @@ E22.py:106:7: E226 Missing whitespace around arithmetic operator 106 | z = 2//30 107 | #: E226 E226 108 | c = (a+b) * (a-b) - | E226 + | ^ E226 109 | #: E226 110 | norman = True+False | @@ -74,7 +74,7 @@ E22.py:106:15: E226 Missing whitespace around arithmetic operator 106 | z = 2//30 107 | #: E226 E226 108 | c = (a+b) * (a-b) - | E226 + | ^ E226 109 | #: E226 110 | norman = True+False | @@ -84,7 +84,7 @@ E22.py:110:6: E226 Missing whitespace around arithmetic operator 110 | norman = True+False 111 | #: E226 112 | x = x*2 - 1 - | E226 + | ^ E226 113 | #: E226 114 | x = x/2 - 1 | @@ -94,7 +94,7 @@ E22.py:112:6: E226 Missing whitespace around arithmetic operator 112 | x = x*2 - 1 113 | #: E226 114 | x = x/2 - 1 - | E226 + | ^ E226 115 | #: E226 E226 116 | hypot2 = x*x + y*y | @@ -104,7 +104,7 @@ E22.py:114:11: E226 Missing whitespace around arithmetic operator 114 | x = x/2 - 1 115 | #: E226 E226 116 | hypot2 = x*x + y*y - | E226 + | ^ E226 117 | #: E226 118 | c = (a + b)*(a - b) | @@ -114,7 +114,7 @@ E22.py:114:17: E226 Missing whitespace around arithmetic operator 114 | x = x/2 - 1 115 | #: E226 E226 116 | hypot2 = x*x + y*y - | E226 + | ^ E226 117 | #: E226 118 | c = (a + b)*(a - b) | @@ -124,7 +124,7 @@ E22.py:116:12: E226 Missing whitespace around arithmetic operator 116 | hypot2 = x*x + y*y 117 | #: E226 118 | c = (a + b)*(a - b) - | E226 + | ^ E226 119 | #: E226 120 | def halves(n): | @@ -134,7 +134,7 @@ E22.py:119:14: E226 Missing whitespace around arithmetic operator 119 | #: E226 120 | def halves(n): 121 | return (i//2 for i in range(n)) - | E226 + | ^^ E226 122 | #: E227 123 | _1kB = _1MB>>10 | diff --git a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E227_E22.py.snap b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E227_E22.py.snap index f482ceb131..06b73ec109 100644 --- a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E227_E22.py.snap +++ b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E227_E22.py.snap @@ -6,7 +6,7 @@ E22.py:121:12: E227 Missing whitespace around bitwise or shift operator 121 | return (i//2 for i in range(n)) 122 | #: E227 123 | _1kB = _1MB>>10 - | E227 + | ^^ E227 124 | #: E227 125 | _1MB = _1kB<<10 | @@ -16,7 +16,7 @@ E22.py:123:12: E227 Missing whitespace around bitwise or shift operator 123 | _1kB = _1MB>>10 124 | #: E227 125 | _1MB = _1kB<<10 - | E227 + | ^^ E227 126 | #: E227 127 | a = b|c | @@ -26,7 +26,7 @@ E22.py:125:6: E227 Missing whitespace around bitwise or shift operator 125 | _1MB = _1kB<<10 126 | #: E227 127 | a = b|c - | E227 + | ^ E227 128 | #: E227 129 | b = c&a | @@ -36,7 +36,7 @@ E22.py:127:6: E227 Missing whitespace around bitwise or shift operator 127 | a = b|c 128 | #: E227 129 | b = c&a - | E227 + | ^ E227 130 | #: E227 131 | c = b^a | @@ -46,7 +46,7 @@ E22.py:129:6: E227 Missing whitespace around bitwise or shift operator 129 | b = c&a 130 | #: E227 131 | c = b^a - | E227 + | ^ E227 132 | #: E228 133 | a = b%c | diff --git a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E228_E22.py.snap b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E228_E22.py.snap index fbb2c5c510..6c4e0ca525 100644 --- a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E228_E22.py.snap +++ b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E228_E22.py.snap @@ -6,7 +6,7 @@ E22.py:131:6: E228 Missing whitespace around modulo operator 131 | c = b^a 132 | #: E228 133 | a = b%c - | E228 + | ^ E228 134 | #: E228 135 | msg = fmt%(errno, errmsg) | @@ -16,7 +16,7 @@ E22.py:133:10: E228 Missing whitespace around modulo operator 133 | a = b%c 134 | #: E228 135 | msg = fmt%(errno, errmsg) - | E228 + | ^ E228 136 | #: E228 137 | msg = "Error %d occurred"%errno | @@ -26,7 +26,7 @@ E22.py:135:26: E228 Missing whitespace around modulo operator 135 | msg = fmt%(errno, errmsg) 136 | #: E228 137 | msg = "Error %d occurred"%errno - | E228 + | ^ E228 138 | #: | diff --git a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E231_E23.py.snap b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E231_E23.py.snap index 26828dc776..2560912f77 100644 --- a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E231_E23.py.snap +++ b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E231_E23.py.snap @@ -5,7 +5,7 @@ E23.py:2:7: E231 [*] Missing whitespace after ',' | 2 | #: E231 3 | a = (1,2) - | E231 + | ^ E231 4 | #: E231 5 | a[b1,:] | @@ -24,7 +24,7 @@ E23.py:4:5: E231 [*] Missing whitespace after ',' 4 | a = (1,2) 5 | #: E231 6 | a[b1,:] - | E231 + | ^ E231 7 | #: E231 8 | a = [{'a':''}] | @@ -45,7 +45,7 @@ E23.py:6:10: E231 [*] Missing whitespace after ':' 6 | a[b1,:] 7 | #: E231 8 | a = [{'a':''}] - | E231 + | ^ E231 9 | #: Okay 10 | a = (4,) | @@ -66,7 +66,7 @@ E23.py:19:10: E231 [*] Missing whitespace after ',' 19 | def foo() -> None: 20 | #: E231 21 | if (1,2): - | E231 + | ^ E231 22 | pass | = help: Added missing whitespace after ',' diff --git a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E251_E25.py.snap b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E251_E25.py.snap index 723f894708..be800bd0fb 100644 --- a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E251_E25.py.snap +++ b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E251_E25.py.snap @@ -5,7 +5,7 @@ E25.py:2:12: E251 Unexpected spaces around keyword / parameter equals | 2 | #: E251 E251 3 | def foo(bar = False): - | E251 + | ^ E251 4 | '''Test function with an error in declaration''' 5 | pass | @@ -14,7 +14,7 @@ E25.py:2:14: E251 Unexpected spaces around keyword / parameter equals | 2 | #: E251 E251 3 | def foo(bar = False): - | E251 + | ^ E251 4 | '''Test function with an error in declaration''' 5 | pass | @@ -24,7 +24,7 @@ E25.py:6:9: E251 Unexpected spaces around keyword / parameter equals 6 | pass 7 | #: E251 8 | foo(bar= True) - | E251 + | ^ E251 9 | #: E251 10 | foo(bar =True) | @@ -34,7 +34,7 @@ E25.py:8:8: E251 Unexpected spaces around keyword / parameter equals 8 | foo(bar= True) 9 | #: E251 10 | foo(bar =True) - | E251 + | ^ E251 11 | #: E251 E251 12 | foo(bar = True) | @@ -44,7 +44,7 @@ E25.py:10:8: E251 Unexpected spaces around keyword / parameter equals 10 | foo(bar =True) 11 | #: E251 E251 12 | foo(bar = True) - | E251 + | ^ E251 13 | #: E251 14 | y = bar(root= "sdasd") | @@ -54,7 +54,7 @@ E25.py:10:10: E251 Unexpected spaces around keyword / parameter equals 10 | foo(bar =True) 11 | #: E251 E251 12 | foo(bar = True) - | E251 + | ^ E251 13 | #: E251 14 | y = bar(root= "sdasd") | @@ -64,29 +64,33 @@ E25.py:12:14: E251 Unexpected spaces around keyword / parameter equals 12 | foo(bar = True) 13 | #: E251 14 | y = bar(root= "sdasd") - | E251 + | ^ E251 15 | #: E251:2:29 16 | parser.add_argument('--long-option', | E25.py:15:29: E251 Unexpected spaces around keyword / parameter equals | -15 | #: E251:2:29 -16 | parser.add_argument('--long-option', -17 | default= - | E251 -18 | "/rather/long/filesystem/path/here/blah/blah/blah") -19 | #: E251:1:45 +15 | #: E251:2:29 +16 | parser.add_argument('--long-option', +17 | default= + | _____________________________^ +18 | | "/rather/long/filesystem/path/here/blah/blah/blah") + | |____________________^ E251 +19 | #: E251:1:45 +20 | parser.add_argument('--long-option', default | E25.py:18:45: E251 Unexpected spaces around keyword / parameter equals | -18 | "/rather/long/filesystem/path/here/blah/blah/blah") -19 | #: E251:1:45 -20 | parser.add_argument('--long-option', default - | E251 -21 | ="/rather/long/filesystem/path/here/blah/blah/blah") -22 | #: E251:3:8 E251:3:10 +18 | "/rather/long/filesystem/path/here/blah/blah/blah") +19 | #: E251:1:45 +20 | parser.add_argument('--long-option', default + | _____________________________________________^ +21 | | ="/rather/long/filesystem/path/here/blah/blah/blah") + | |____________________^ E251 +22 | #: E251:3:8 E251:3:10 +23 | foo(True, | E25.py:23:8: E251 Unexpected spaces around keyword / parameter equals @@ -94,7 +98,7 @@ E25.py:23:8: E251 Unexpected spaces around keyword / parameter equals 23 | foo(True, 24 | baz=(1, 2), 25 | biz = 'foo' - | E251 + | ^ E251 26 | ) 27 | #: Okay | @@ -104,7 +108,7 @@ E25.py:23:10: E251 Unexpected spaces around keyword / parameter equals 23 | foo(True, 24 | baz=(1, 2), 25 | biz = 'foo' - | E251 + | ^ E251 26 | ) 27 | #: Okay | diff --git a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E252_E25.py.snap b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E252_E25.py.snap index 00acfa92e6..e6b060c884 100644 --- a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E252_E25.py.snap +++ b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E252_E25.py.snap @@ -6,27 +6,27 @@ E25.py:46:15: E252 Missing whitespace around parameter equals 46 | return a + b 47 | #: E252:1:15 E252:1:16 E252:1:27 E252:1:36 48 | def add(a: int=0, b: int =0, c: int= 0) -> int: - | E252 + | ^ E252 49 | return a + b + c 50 | #: Okay | -E25.py:46:16: E252 Missing whitespace around parameter equals +E25.py:46:15: E252 Missing whitespace around parameter equals | 46 | return a + b 47 | #: E252:1:15 E252:1:16 E252:1:27 E252:1:36 48 | def add(a: int=0, b: int =0, c: int= 0) -> int: - | E252 + | ^ E252 49 | return a + b + c 50 | #: Okay | -E25.py:46:27: E252 Missing whitespace around parameter equals +E25.py:46:26: E252 Missing whitespace around parameter equals | 46 | return a + b 47 | #: E252:1:15 E252:1:16 E252:1:27 E252:1:36 48 | def add(a: int=0, b: int =0, c: int= 0) -> int: - | E252 + | ^ E252 49 | return a + b + c 50 | #: Okay | @@ -36,7 +36,7 @@ E25.py:46:36: E252 Missing whitespace around parameter equals 46 | return a + b 47 | #: E252:1:15 E252:1:16 E252:1:27 E252:1:36 48 | def add(a: int=0, b: int =0, c: int= 0) -> int: - | E252 + | ^ E252 49 | return a + b + c 50 | #: Okay | diff --git a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E271_E27.py.snap b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E271_E27.py.snap index d4e838c49f..841b925644 100644 --- a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E271_E27.py.snap +++ b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E271_E27.py.snap @@ -6,7 +6,7 @@ E27.py:4:9: E271 Multiple spaces after keyword 4 | True and False 5 | #: E271 6 | True and False - | E271 + | ^^ E271 7 | #: E272 8 | True and False | @@ -16,7 +16,7 @@ E27.py:6:5: E271 Multiple spaces after keyword 6 | True and False 7 | #: E272 8 | True and False - | E271 + | ^^ E271 9 | #: E271 10 | if 1: | @@ -26,7 +26,7 @@ E27.py:8:3: E271 Multiple spaces after keyword 8 | True and False 9 | #: E271 10 | if 1: - | E271 + | ^^^ E271 11 | #: E273 12 | True and False | @@ -36,7 +36,7 @@ E27.py:14:6: E271 Multiple spaces after keyword 14 | True and False 15 | #: E271 16 | a and b - | E271 + | ^^ E271 17 | #: E271 18 | 1 and b | @@ -46,7 +46,7 @@ E27.py:16:6: E271 Multiple spaces after keyword 16 | a and b 17 | #: E271 18 | 1 and b - | E271 + | ^^ E271 19 | #: E271 20 | a and 2 | @@ -56,7 +56,7 @@ E27.py:18:6: E271 Multiple spaces after keyword 18 | 1 and b 19 | #: E271 20 | a and 2 - | E271 + | ^^ E271 21 | #: E271 E272 22 | 1 and b | @@ -66,7 +66,7 @@ E27.py:20:7: E271 Multiple spaces after keyword 20 | a and 2 21 | #: E271 E272 22 | 1 and b - | E271 + | ^^ E271 23 | #: E271 E272 24 | a and 2 | @@ -76,7 +76,7 @@ E27.py:22:7: E271 Multiple spaces after keyword 22 | 1 and b 23 | #: E271 E272 24 | a and 2 - | E271 + | ^^ E271 25 | #: E272 26 | this and False | @@ -86,7 +86,7 @@ E27.py:35:14: E271 Multiple spaces after keyword 35 | from v import c, d 36 | #: E271 37 | from w import (e, f) - | E271 + | ^^ E271 38 | #: E275 39 | from w import(e, f) | diff --git a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E272_E27.py.snap b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E272_E27.py.snap index d295b49602..cd1e6c64a4 100644 --- a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E272_E27.py.snap +++ b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E272_E27.py.snap @@ -6,7 +6,7 @@ E27.py:20:2: E272 Multiple spaces before keyword 20 | a and 2 21 | #: E271 E272 22 | 1 and b - | E272 + | ^^ E272 23 | #: E271 E272 24 | a and 2 | @@ -16,7 +16,7 @@ E27.py:22:2: E272 Multiple spaces before keyword 22 | 1 and b 23 | #: E271 E272 24 | a and 2 - | E272 + | ^^ E272 25 | #: E272 26 | this and False | @@ -26,7 +26,7 @@ E27.py:24:5: E272 Multiple spaces before keyword 24 | a and 2 25 | #: E272 26 | this and False - | E272 + | ^^ E272 27 | #: E273 28 | a and b | diff --git a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E273_E27.py.snap b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E273_E27.py.snap index ea55c2f8db..4bec40e239 100644 --- a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E273_E27.py.snap +++ b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E273_E27.py.snap @@ -6,7 +6,7 @@ E27.py:10:9: E273 Tab after keyword 10 | if 1: 11 | #: E273 12 | True and False - | E273 + | ^^^^^^^^ E273 13 | #: E273 E274 14 | True and False | @@ -16,7 +16,7 @@ E27.py:12:5: E273 Tab after keyword 12 | True and False 13 | #: E273 E274 14 | True and False - | E273 + | ^^^^^^^^ E273 15 | #: E271 16 | a and b | @@ -26,7 +26,7 @@ E27.py:12:10: E273 Tab after keyword 12 | True and False 13 | #: E273 E274 14 | True and False - | E273 + | ^ E273 15 | #: E271 16 | a and b | @@ -36,7 +36,7 @@ E27.py:26:6: E273 Tab after keyword 26 | this and False 27 | #: E273 28 | a and b - | E273 + | ^^^ E273 29 | #: E274 30 | a and b | @@ -46,7 +46,7 @@ E27.py:30:10: E273 Tab after keyword 30 | a and b 31 | #: E273 E274 32 | this and False - | E273 + | ^ E273 33 | #: Okay 34 | from u import (a, b) | diff --git a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E274_E27.py.snap b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E274_E27.py.snap index f70b51e63d..fb5091c264 100644 --- a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E274_E27.py.snap +++ b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E274_E27.py.snap @@ -1,22 +1,22 @@ --- source: crates/ruff/src/rules/pycodestyle/mod.rs --- -E27.py:28:3: E274 Tab before keyword +E27.py:28:2: E274 Tab before keyword | 28 | a and b 29 | #: E274 30 | a and b - | E274 + | ^^^^^^^ E274 31 | #: E273 E274 32 | this and False | -E27.py:30:6: E274 Tab before keyword +E27.py:30:5: E274 Tab before keyword | 30 | a and b 31 | #: E273 E274 32 | this and False - | E274 + | ^^^^^^^^ E274 33 | #: Okay 34 | from u import (a, b) | diff --git a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E275_E27.py.snap b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E275_E27.py.snap index fa43f95e73..24f27ec0e4 100644 --- a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E275_E27.py.snap +++ b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E275_E27.py.snap @@ -1,52 +1,52 @@ --- source: crates/ruff/src/rules/pycodestyle/mod.rs --- -E27.py:37:14: E275 Missing whitespace after keyword +E27.py:37:8: E275 Missing whitespace after keyword | 37 | from w import (e, f) 38 | #: E275 39 | from w import(e, f) - | E275 + | ^^^^^^ E275 40 | #: E275 41 | from importable.module import(e, f) | -E27.py:39:30: E275 Missing whitespace after keyword +E27.py:39:24: E275 Missing whitespace after keyword | 39 | from w import(e, f) 40 | #: E275 41 | from importable.module import(e, f) - | E275 + | ^^^^^^ E275 42 | #: E275 43 | try: | -E27.py:42:34: E275 Missing whitespace after keyword +E27.py:42:28: E275 Missing whitespace after keyword | 42 | #: E275 43 | try: 44 | from importable.module import(e, f) - | E275 + | ^^^^^^ E275 45 | except ImportError: 46 | pass | -E27.py:46:3: E275 Missing whitespace after keyword +E27.py:46:1: E275 Missing whitespace after keyword | 46 | pass 47 | #: E275 48 | if(foo): - | E275 + | ^^ E275 49 | pass 50 | else: | -E27.py:54:11: E275 Missing whitespace after keyword +E27.py:54:5: E275 Missing whitespace after keyword | 54 | #: E275:2:11 55 | if True: 56 | assert(1) - | E275 + | ^^^^^^ E275 57 | #: Okay 58 | def f(): |