Use non-empty ranges for logical-lines diagnostics (#4133)

This commit is contained in:
Micha Reiser 2023-05-10 08:44:33 +02:00 committed by GitHub
parent cf7aa26aa4
commit bfa1c28c00
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 234 additions and 231 deletions

View file

@ -109,8 +109,12 @@ pub(crate) fn extraneous_whitespace(line: &LogicalLine, context: &mut LogicalLin
let kind = token.kind(); let kind = token.kind();
match kind { match kind {
TokenKind::Lbrace | TokenKind::Lpar | TokenKind::Lsqb => { TokenKind::Lbrace | TokenKind::Lpar | TokenKind::Lsqb => {
if !matches!(line.trailing_whitespace(token), Whitespace::None) { let (trailing, trailing_len) = line.trailing_whitespace(token);
context.push(WhitespaceAfterOpenBracket, TextRange::empty(token.end())); if !matches!(trailing, Whitespace::None) {
context.push(
WhitespaceAfterOpenBracket,
TextRange::at(token.end(), trailing_len),
);
} }
} }
TokenKind::Rbrace TokenKind::Rbrace
@ -119,10 +123,10 @@ pub(crate) fn extraneous_whitespace(line: &LogicalLine, context: &mut LogicalLin
| TokenKind::Comma | TokenKind::Comma
| TokenKind::Semi | TokenKind::Semi
| TokenKind::Colon => { | TokenKind::Colon => {
if let (Whitespace::Single | Whitespace::Many | Whitespace::Tab, offset) = if !matches!(last_token, TokenKind::Comma | TokenKind::EndOfFile) {
line.leading_whitespace(token) if let (Whitespace::Single | Whitespace::Many | Whitespace::Tab, offset) =
{ line.leading_whitespace(token)
if !matches!(last_token, TokenKind::Comma | TokenKind::EndOfFile) { {
let diagnostic_kind = if matches!( let diagnostic_kind = if matches!(
kind, kind,
TokenKind::Comma | TokenKind::Semi | TokenKind::Colon TokenKind::Comma | TokenKind::Semi | TokenKind::Colon
@ -132,7 +136,10 @@ pub(crate) fn extraneous_whitespace(line: &LogicalLine, context: &mut LogicalLin
DiagnosticKind::from(WhitespaceBeforeCloseBracket) DiagnosticKind::from(WhitespaceBeforeCloseBracket)
}; };
context.push(diagnostic_kind, TextRange::empty(token.start() - offset)); context.push(
diagnostic_kind,
TextRange::at(token.start() - offset, offset),
);
} }
} }
} }

View file

@ -4,7 +4,7 @@ use ruff_diagnostics::Edit;
use ruff_diagnostics::{AlwaysAutofixableViolation, Diagnostic, Fix}; use ruff_diagnostics::{AlwaysAutofixableViolation, Diagnostic, Fix};
use ruff_macros::{derive_message_formats, violation}; use ruff_macros::{derive_message_formats, violation};
use ruff_python_ast::token_kind::TokenKind; use ruff_python_ast::token_kind::TokenKind;
use ruff_text_size::{TextRange, TextSize}; use ruff_text_size::TextSize;
#[violation] #[violation]
pub struct MissingWhitespace { pub struct MissingWhitespace {
@ -82,8 +82,7 @@ pub(crate) fn missing_whitespace(
} }
let kind = MissingWhitespace { token: kind }; let kind = MissingWhitespace { token: kind };
let mut diagnostic = Diagnostic::new(kind, token.range());
let mut diagnostic = Diagnostic::new(kind, TextRange::empty(token.start()));
if autofix { if autofix {
#[allow(deprecated)] #[allow(deprecated)]

View file

@ -3,7 +3,6 @@ use crate::rules::pycodestyle::rules::logical_lines::LogicalLine;
use ruff_diagnostics::Violation; use ruff_diagnostics::Violation;
use ruff_macros::{derive_message_formats, violation}; use ruff_macros::{derive_message_formats, violation};
use ruff_python_ast::token_kind::TokenKind; use ruff_python_ast::token_kind::TokenKind;
use ruff_text_size::TextRange;
#[violation] #[violation]
pub struct MissingWhitespaceAfterKeyword; pub struct MissingWhitespaceAfterKeyword;
@ -35,7 +34,7 @@ pub(crate) fn missing_whitespace_after_keyword(
|| matches!(tok1_kind, TokenKind::Colon | TokenKind::Newline)) || matches!(tok1_kind, TokenKind::Colon | TokenKind::Newline))
&& tok0.end() == tok1.start() && tok0.end() == tok1.start()
{ {
context.push(MissingWhitespaceAfterKeyword, TextRange::empty(tok0.end())); context.push(MissingWhitespaceAfterKeyword, tok0.range());
} }
} }
} }

View file

@ -3,7 +3,6 @@ use crate::rules::pycodestyle::rules::logical_lines::{LogicalLine, LogicalLineTo
use ruff_diagnostics::{DiagnosticKind, Violation}; use ruff_diagnostics::{DiagnosticKind, Violation};
use ruff_macros::{derive_message_formats, violation}; use ruff_macros::{derive_message_formats, violation};
use ruff_python_ast::token_kind::TokenKind; use ruff_python_ast::token_kind::TokenKind;
use ruff_text_size::TextRange;
// E225 // E225
#[violation] #[violation]
@ -129,30 +128,20 @@ pub(crate) fn missing_whitespace_around_operator(
match (has_leading_trivia, has_trailing_trivia) { match (has_leading_trivia, has_trailing_trivia) {
// Operator with trailing but no leading space, enforce consistent spacing // Operator with trailing but no leading space, enforce consistent spacing
(false, true) => { (false, true) |
context.push(
MissingWhitespaceAroundOperator,
TextRange::empty(token.start()),
);
}
// Operator with leading but no trailing space, enforce consistent spacing. // Operator with leading but no trailing space, enforce consistent spacing.
(true, false) => { (true, false)
context.push( => {
MissingWhitespaceAroundOperator, context.push(MissingWhitespaceAroundOperator, token.range());
TextRange::empty(token.end()),
);
} }
// Operator with no space, require spaces if it is required by the operator. // Operator with no space, require spaces if it is required by the operator.
(false, false) => { (false, false) => {
if needs_space == NeedsSpace::Yes { if needs_space == NeedsSpace::Yes {
context.push( context.push(diagnostic_kind_for_operator(kind), token.range());
diagnostic_kind_for_operator(kind),
TextRange::empty(token.start()),
);
} }
} }
(true, true) => { (true, true) => {
// Operator has leading and trailing space, all good // Operator has leading and trailing spaces, all good
} }
} }
} }

View file

@ -240,8 +240,8 @@ impl<'a> LogicalLine<'a> {
.slice(TextRange::new(first_token.start(), token.start())) .slice(TextRange::new(first_token.start(), token.start()))
} }
/// Returns the whitespace *after* the `token` /// Returns the whitespace *after* the `token` with the byte length
pub fn trailing_whitespace(&self, token: &'a LogicalLineToken) -> Whitespace { pub fn trailing_whitespace(&self, token: &'a LogicalLineToken) -> (Whitespace, TextSize) {
Whitespace::leading(self.text_after(token)) Whitespace::leading(self.text_after(token))
} }
@ -358,35 +358,45 @@ pub(crate) enum Whitespace {
} }
impl Whitespace { impl Whitespace {
fn leading(content: &str) -> Self { fn leading(content: &str) -> (Self, TextSize) {
let mut count = 0u32; let mut count = 0u32;
let mut len = TextSize::default();
let mut has_tabs = false;
for c in content.chars() { for c in content.chars() {
if c == '\t' { if c == '\t' {
return Self::Tab; has_tabs = true;
len += c.text_len();
} else if matches!(c, '\n' | '\r') { } else if matches!(c, '\n' | '\r') {
break; break;
} else if c.is_whitespace() { } else if c.is_whitespace() {
count += 1; count += 1;
len += c.text_len();
} else { } else {
break; break;
} }
} }
match count { if has_tabs {
0 => Whitespace::None, (Whitespace::Tab, len)
1 => Whitespace::Single, } else {
_ => Whitespace::Many, match count {
0 => (Whitespace::None, len),
1 => (Whitespace::Single, len),
_ => (Whitespace::Many, len),
}
} }
} }
fn trailing(content: &str) -> (Self, TextSize) { fn trailing(content: &str) -> (Self, TextSize) {
let mut len = TextSize::default(); let mut len = TextSize::default();
let mut count = 0usize; let mut count = 0usize;
let mut has_tabs = false;
for c in content.chars().rev() { for c in content.chars().rev() {
if c == '\t' { if c == '\t' {
return (Self::Tab, len + c.text_len()); has_tabs = true;
len += c.text_len();
} else if matches!(c, '\n' | '\r') { } else if matches!(c, '\n' | '\r') {
// Indent // Indent
return (Self::None, TextSize::default()); return (Self::None, TextSize::default());
@ -398,15 +408,19 @@ impl Whitespace {
} }
} }
match count { if has_tabs {
0 => (Self::None, TextSize::default()), (Self::Tab, len)
1 => (Self::Single, len), } else {
_ => { match count {
if len == content.text_len() { 0 => (Self::None, TextSize::default()),
// All whitespace up to the start of the line -> Indent 1 => (Self::Single, len),
(Self::None, TextSize::default()) _ => {
} else { if len == content.text_len() {
(Self::Many, len) // All whitespace up to the start of the line -> Indent
(Self::None, TextSize::default())
} else {
(Self::Many, len)
}
} }
} }
} }

View file

@ -133,14 +133,15 @@ pub(crate) fn space_around_operator(line: &LogicalLine, context: &mut LogicalLin
if !after_operator { if !after_operator {
match line.leading_whitespace(token) { match line.leading_whitespace(token) {
(Whitespace::Tab, offset) => { (Whitespace::Tab, offset) => {
let start = token.start(); context.push(
context.push(TabBeforeOperator, TextRange::empty(start - offset)); TabBeforeOperator,
TextRange::at(token.start() - offset, offset),
);
} }
(Whitespace::Many, offset) => { (Whitespace::Many, offset) => {
let start = token.start();
context.push( context.push(
MultipleSpacesBeforeOperator, 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) { match line.trailing_whitespace(token) {
Whitespace::Tab => { (Whitespace::Tab, len) => {
let end = token.end(); context.push(TabAfterOperator, TextRange::at(token.end(), len));
context.push(TabAfterOperator, TextRange::empty(end));
} }
Whitespace::Many => { (Whitespace::Many, len) => {
let end = token.end(); context.push(MultipleSpacesAfterOperator, TextRange::at(token.end(), len));
context.push(MultipleSpacesAfterOperator, TextRange::empty(end));
} }
_ => {} _ => {}
} }

View file

@ -118,13 +118,13 @@ pub(crate) fn whitespace_around_keywords(line: &LogicalLine, context: &mut Logic
match line.leading_whitespace(token) { match line.leading_whitespace(token) {
(Whitespace::Tab, offset) => { (Whitespace::Tab, offset) => {
let start = token.start(); let start = token.start();
context.push(TabBeforeKeyword, TextRange::empty(start - offset)); context.push(TabBeforeKeyword, TextRange::at(start - offset, offset));
} }
(Whitespace::Many, offset) => { (Whitespace::Many, offset) => {
let start = token.start(); let start = token.start();
context.push( context.push(
MultipleSpacesBeforeKeyword, 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) { match line.trailing_whitespace(token) {
Whitespace::Tab => { (Whitespace::Tab, len) => {
let end = token.end(); context.push(TabAfterKeyword, TextRange::at(token.end(), len));
context.push(TabAfterKeyword, TextRange::empty(end));
} }
Whitespace::Many => { (Whitespace::Many, len) => {
let end = token.end(); context.push(MultipleSpacesAfterKeyword, TextRange::at(token.end(), len));
context.push(MultipleSpacesAfterKeyword, TextRange::empty(end));
} }
_ => {} _ => {}
} }

View file

@ -78,10 +78,7 @@ pub(crate) fn whitespace_around_named_parameter_equals(
if annotated_func_arg && parens == 1 { if annotated_func_arg && parens == 1 {
let start = token.start(); let start = token.start();
if start == prev_end && prev_end != TextSize::new(0) { if start == prev_end && prev_end != TextSize::new(0) {
context.push( context.push(MissingWhitespaceAroundParameterEquals, token.range());
MissingWhitespaceAroundParameterEquals,
TextRange::empty(start),
);
} }
while let Some(next) = iter.peek() { while let Some(next) = iter.peek() {
@ -91,10 +88,7 @@ pub(crate) fn whitespace_around_named_parameter_equals(
let next_start = next.start(); let next_start = next.start();
if next_start == token.end() { if next_start == token.end() {
context.push( context.push(MissingWhitespaceAroundParameterEquals, token.range());
MissingWhitespaceAroundParameterEquals,
TextRange::empty(next_start),
);
} }
break; break;
} }
@ -103,7 +97,7 @@ pub(crate) fn whitespace_around_named_parameter_equals(
if token.start() != prev_end { if token.start() != prev_end {
context.push( context.push(
UnexpectedSpacesAroundKeywordParameterEquals, 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() { if next.start() != token.end() {
context.push( context.push(
UnexpectedSpacesAroundKeywordParameterEquals, UnexpectedSpacesAroundKeywordParameterEquals,
TextRange::empty(token.end()), TextRange::new(token.end(), next.start()),
); );
} }
break; break;

View file

@ -5,7 +5,7 @@ E20.py:2:6: E201 Whitespace after '('
| |
2 | #: E201:1:6 2 | #: E201:1:6
3 | spam( ham[1], {eggs: 2}) 3 | spam( ham[1], {eggs: 2})
| E201 | ^ E201
4 | #: E201:1:10 4 | #: E201:1:10
5 | spam(ham[ 1], {eggs: 2}) 5 | spam(ham[ 1], {eggs: 2})
| |
@ -15,7 +15,7 @@ E20.py:4:10: E201 Whitespace after '('
4 | spam( ham[1], {eggs: 2}) 4 | spam( ham[1], {eggs: 2})
5 | #: E201:1:10 5 | #: E201:1:10
6 | spam(ham[ 1], {eggs: 2}) 6 | spam(ham[ 1], {eggs: 2})
| E201 | ^ E201
7 | #: E201:1:15 7 | #: E201:1:15
8 | spam(ham[1], { eggs: 2}) 8 | spam(ham[1], { eggs: 2})
| |
@ -25,7 +25,7 @@ E20.py:6:15: E201 Whitespace after '('
6 | spam(ham[ 1], {eggs: 2}) 6 | spam(ham[ 1], {eggs: 2})
7 | #: E201:1:15 7 | #: E201:1:15
8 | spam(ham[1], { eggs: 2}) 8 | spam(ham[1], { eggs: 2})
| E201 | ^ E201
9 | #: E201:1:6 9 | #: E201:1:6
10 | spam( ham[1], {eggs: 2}) 10 | spam( ham[1], {eggs: 2})
| |
@ -35,7 +35,7 @@ E20.py:8:6: E201 Whitespace after '('
8 | spam(ham[1], { eggs: 2}) 8 | spam(ham[1], { eggs: 2})
9 | #: E201:1:6 9 | #: E201:1:6
10 | spam( ham[1], {eggs: 2}) 10 | spam( ham[1], {eggs: 2})
| E201 | ^^^ E201
11 | #: E201:1:10 11 | #: E201:1:10
12 | spam(ham[ 1], {eggs: 2}) 12 | spam(ham[ 1], {eggs: 2})
| |
@ -45,7 +45,7 @@ E20.py:10:10: E201 Whitespace after '('
10 | spam( ham[1], {eggs: 2}) 10 | spam( ham[1], {eggs: 2})
11 | #: E201:1:10 11 | #: E201:1:10
12 | spam(ham[ 1], {eggs: 2}) 12 | spam(ham[ 1], {eggs: 2})
| E201 | ^^^ E201
13 | #: E201:1:15 13 | #: E201:1:15
14 | spam(ham[1], { eggs: 2}) 14 | spam(ham[1], { eggs: 2})
| |
@ -55,7 +55,7 @@ E20.py:12:15: E201 Whitespace after '('
12 | spam(ham[ 1], {eggs: 2}) 12 | spam(ham[ 1], {eggs: 2})
13 | #: E201:1:15 13 | #: E201:1:15
14 | spam(ham[1], { eggs: 2}) 14 | spam(ham[1], { eggs: 2})
| E201 | ^^ E201
15 | #: Okay 15 | #: Okay
16 | spam(ham[1], {eggs: 2}) 16 | spam(ham[1], {eggs: 2})
| |

View file

@ -5,7 +5,7 @@ E20.py:19:23: E202 Whitespace before ')'
| |
19 | #: E202:1:23 19 | #: E202:1:23
20 | spam(ham[1], {eggs: 2} ) 20 | spam(ham[1], {eggs: 2} )
| E202 | ^ E202
21 | #: E202:1:22 21 | #: E202:1:22
22 | spam(ham[1], {eggs: 2 }) 22 | spam(ham[1], {eggs: 2 })
| |
@ -15,7 +15,7 @@ E20.py:21:22: E202 Whitespace before ')'
21 | spam(ham[1], {eggs: 2} ) 21 | spam(ham[1], {eggs: 2} )
22 | #: E202:1:22 22 | #: E202:1:22
23 | spam(ham[1], {eggs: 2 }) 23 | spam(ham[1], {eggs: 2 })
| E202 | ^ E202
24 | #: E202:1:11 24 | #: E202:1:11
25 | spam(ham[1 ], {eggs: 2}) 25 | spam(ham[1 ], {eggs: 2})
| |
@ -25,7 +25,7 @@ E20.py:23:11: E202 Whitespace before ')'
23 | spam(ham[1], {eggs: 2 }) 23 | spam(ham[1], {eggs: 2 })
24 | #: E202:1:11 24 | #: E202:1:11
25 | spam(ham[1 ], {eggs: 2}) 25 | spam(ham[1 ], {eggs: 2})
| E202 | ^ E202
26 | #: E202:1:23 26 | #: E202:1:23
27 | spam(ham[1], {eggs: 2} ) 27 | spam(ham[1], {eggs: 2} )
| |
@ -35,7 +35,7 @@ E20.py:25:23: E202 Whitespace before ')'
25 | spam(ham[1 ], {eggs: 2}) 25 | spam(ham[1 ], {eggs: 2})
26 | #: E202:1:23 26 | #: E202:1:23
27 | spam(ham[1], {eggs: 2} ) 27 | spam(ham[1], {eggs: 2} )
| E202 | ^^ E202
28 | #: E202:1:22 28 | #: E202:1:22
29 | spam(ham[1], {eggs: 2 }) 29 | spam(ham[1], {eggs: 2 })
| |
@ -45,7 +45,7 @@ E20.py:27:22: E202 Whitespace before ')'
27 | spam(ham[1], {eggs: 2} ) 27 | spam(ham[1], {eggs: 2} )
28 | #: E202:1:22 28 | #: E202:1:22
29 | spam(ham[1], {eggs: 2 }) 29 | spam(ham[1], {eggs: 2 })
| E202 | ^^^ E202
30 | #: E202:1:11 30 | #: E202:1:11
31 | spam(ham[1 ], {eggs: 2}) 31 | spam(ham[1 ], {eggs: 2})
| |
@ -55,7 +55,7 @@ E20.py:29:11: E202 Whitespace before ')'
29 | spam(ham[1], {eggs: 2 }) 29 | spam(ham[1], {eggs: 2 })
30 | #: E202:1:11 30 | #: E202:1:11
31 | spam(ham[1 ], {eggs: 2}) 31 | spam(ham[1 ], {eggs: 2})
| E202 | ^^ E202
32 | #: Okay 32 | #: Okay
33 | spam(ham[1], {eggs: 2}) 33 | spam(ham[1], {eggs: 2})
| |

View file

@ -5,7 +5,7 @@ E20.py:51:10: E203 Whitespace before ',', ';', or ':'
| |
51 | #: E203:1:10 51 | #: E203:1:10
52 | if x == 4 : 52 | if x == 4 :
| E203 | ^ E203
53 | print x, y 53 | print x, y
54 | x, y = y, x 54 | x, y = y, x
| |
@ -15,7 +15,7 @@ E20.py:55:10: E203 Whitespace before ',', ';', or ':'
55 | x, y = y, x 55 | x, y = y, x
56 | #: E203:1:10 56 | #: E203:1:10
57 | if x == 4 : 57 | if x == 4 :
| E203 | ^^^ E203
58 | print x, y 58 | print x, y
59 | x, y = y, x 59 | x, y = y, x
| |
@ -25,7 +25,7 @@ E20.py:60:15: E203 Whitespace before ',', ';', or ':'
60 | #: E203:2:15 E702:2:16 60 | #: E203:2:15 E702:2:16
61 | if x == 4: 61 | if x == 4:
62 | print x, y ; x, y = y, x 62 | print x, y ; x, y = y, x
| E203 | ^ E203
63 | #: E203:2:15 E702:2:16 63 | #: E203:2:15 E702:2:16
64 | if x == 4: 64 | if x == 4:
| |
@ -35,7 +35,7 @@ E20.py:63:15: E203 Whitespace before ',', ';', or ':'
63 | #: E203:2:15 E702:2:16 63 | #: E203:2:15 E702:2:16
64 | if x == 4: 64 | if x == 4:
65 | print x, y ; x, y = y, x 65 | print x, y ; x, y = y, x
| E203 | ^^ E203
66 | #: E203:3:13 66 | #: E203:3:13
67 | if x == 4: 67 | if x == 4:
| |
@ -45,7 +45,7 @@ E20.py:67:13: E203 Whitespace before ',', ';', or ':'
67 | if x == 4: 67 | if x == 4:
68 | print x, y 68 | print x, y
69 | x, y = y , x 69 | x, y = y , x
| E203 | ^ E203
70 | #: E203:3:13 70 | #: E203:3:13
71 | if x == 4: 71 | if x == 4:
| |
@ -55,7 +55,7 @@ E20.py:71:13: E203 Whitespace before ',', ';', or ':'
71 | if x == 4: 71 | if x == 4:
72 | print x, y 72 | print x, y
73 | x, y = y , x 73 | x, y = y , x
| E203 | ^^^^ E203
74 | #: Okay 74 | #: Okay
75 | if x == 4: 75 | if x == 4:
| |

View file

@ -6,7 +6,7 @@ E22.py:3:6: E221 Multiple spaces before operator
3 | #: E221 3 | #: E221
4 | a = 12 + 3 4 | a = 12 + 3
5 | b = 4 + 5 5 | b = 4 + 5
| E221 | ^^ E221
6 | #: E221 E221 6 | #: E221 E221
7 | x = 1 7 | x = 1
| |
@ -16,7 +16,7 @@ E22.py:5:2: E221 Multiple spaces before operator
5 | b = 4 + 5 5 | b = 4 + 5
6 | #: E221 E221 6 | #: E221 E221
7 | x = 1 7 | x = 1
| E221 | ^^^^^^^^^^^^^ E221
8 | y = 2 8 | y = 2
9 | long_variable = 3 9 | long_variable = 3
| |
@ -26,7 +26,7 @@ E22.py:6:2: E221 Multiple spaces before operator
6 | #: E221 E221 6 | #: E221 E221
7 | x = 1 7 | x = 1
8 | y = 2 8 | y = 2
| E221 | ^^^^^^^^^^^^^ E221
9 | long_variable = 3 9 | long_variable = 3
10 | #: E221 E221 10 | #: E221 E221
| |
@ -36,7 +36,7 @@ E22.py:9:5: E221 Multiple spaces before operator
9 | long_variable = 3 9 | long_variable = 3
10 | #: E221 E221 10 | #: E221 E221
11 | x[0] = 1 11 | x[0] = 1
| E221 | ^^^^^^^^^^ E221
12 | x[1] = 2 12 | x[1] = 2
13 | long_variable = 3 13 | long_variable = 3
| |
@ -46,7 +46,7 @@ E22.py:10:5: E221 Multiple spaces before operator
10 | #: E221 E221 10 | #: E221 E221
11 | x[0] = 1 11 | x[0] = 1
12 | x[1] = 2 12 | x[1] = 2
| E221 | ^^^^^^^^^^ E221
13 | long_variable = 3 13 | long_variable = 3
14 | #: E221 E221 14 | #: E221 E221
| |
@ -56,7 +56,7 @@ E22.py:13:9: E221 Multiple spaces before operator
13 | long_variable = 3 13 | long_variable = 3
14 | #: E221 E221 14 | #: E221 E221
15 | x = f(x) + 1 15 | x = f(x) + 1
| E221 | ^^^^^^^^^^ E221
16 | y = long_variable + 2 16 | y = long_variable + 2
17 | z = x[0] + 3 17 | z = x[0] + 3
| |
@ -66,7 +66,7 @@ E22.py:15:9: E221 Multiple spaces before operator
15 | x = f(x) + 1 15 | x = f(x) + 1
16 | y = long_variable + 2 16 | y = long_variable + 2
17 | z = x[0] + 3 17 | z = x[0] + 3
| E221 | ^^^^^^^^^^ E221
18 | #: E221:3:14 18 | #: E221:3:14
19 | text = """ 19 | text = """
| |
@ -76,7 +76,7 @@ E22.py:19:14: E221 Multiple spaces before operator
19 | text = """ 19 | text = """
20 | bar 20 | bar
21 | foo %s""" % rofl 21 | foo %s""" % rofl
| E221 | ^^ E221
22 | #: Okay 22 | #: Okay
23 | x = 1 23 | x = 1
| |

View file

@ -5,7 +5,7 @@ E22.py:28:8: E222 Multiple spaces after operator
| |
28 | #: E222 28 | #: E222
29 | a = a + 1 29 | a = a + 1
| E222 | ^^ E222
30 | b = b + 10 30 | b = b + 10
31 | #: E222 E222 31 | #: E222 E222
| |
@ -15,7 +15,7 @@ E22.py:31:4: E222 Multiple spaces after operator
31 | b = b + 10 31 | b = b + 10
32 | #: E222 E222 32 | #: E222 E222
33 | x = -1 33 | x = -1
| E222 | ^^^^^^^^^^^^ E222
34 | y = -2 34 | y = -2
35 | long_variable = 3 35 | long_variable = 3
| |
@ -25,7 +25,7 @@ E22.py:32:4: E222 Multiple spaces after operator
32 | #: E222 E222 32 | #: E222 E222
33 | x = -1 33 | x = -1
34 | y = -2 34 | y = -2
| E222 | ^^^^^^^^^^^^ E222
35 | long_variable = 3 35 | long_variable = 3
36 | #: E222 E222 36 | #: E222 E222
| |
@ -35,7 +35,7 @@ E22.py:35:7: E222 Multiple spaces after operator
35 | long_variable = 3 35 | long_variable = 3
36 | #: E222 E222 36 | #: E222 E222
37 | x[0] = 1 37 | x[0] = 1
| E222 | ^^^^^^^^^^ E222
38 | x[1] = 2 38 | x[1] = 2
39 | long_variable = 3 39 | long_variable = 3
| |
@ -45,7 +45,7 @@ E22.py:36:7: E222 Multiple spaces after operator
36 | #: E222 E222 36 | #: E222 E222
37 | x[0] = 1 37 | x[0] = 1
38 | x[1] = 2 38 | x[1] = 2
| E222 | ^^^^^^^^^^ E222
39 | long_variable = 3 39 | long_variable = 3
40 | #: 40 | #:
| |

View file

@ -6,7 +6,7 @@ E22.py:43:2: E223 Tab before operator
43 | #: E223 43 | #: E223
44 | foobart = 4 44 | foobart = 4
45 | a = 3 # aligned with tab 45 | a = 3 # aligned with tab
| E223 | ^^^ E223
46 | #: 46 | #:
| |

View file

@ -5,7 +5,7 @@ E22.py:48:5: E224 Tab after operator
| |
48 | #: E224 48 | #: E224
49 | a += 1 49 | a += 1
| E224 | ^^^^ E224
50 | b += 1000 50 | b += 1000
51 | #: 51 | #:
| |

View file

@ -1,11 +1,11 @@
--- ---
source: crates/ruff/src/rules/pycodestyle/mod.rs 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 54 | #: E225
55 | submitted +=1 55 | submitted +=1
| E225 | ^^ E225
56 | #: E225 56 | #: E225
57 | submitted+= 1 57 | submitted+= 1
| |
@ -15,37 +15,37 @@ E22.py:56:10: E225 Missing whitespace around operator
56 | submitted +=1 56 | submitted +=1
57 | #: E225 57 | #: E225
58 | submitted+= 1 58 | submitted+= 1
| E225 | ^^ E225
59 | #: E225 59 | #: E225
60 | c =-1 60 | c =-1
| |
E22.py:58:4: E225 Missing whitespace around operator E22.py:58:3: E225 Missing whitespace around operator
| |
58 | submitted+= 1 58 | submitted+= 1
59 | #: E225 59 | #: E225
60 | c =-1 60 | c =-1
| E225 | ^ E225
61 | #: E225 61 | #: E225
62 | x = x /2 - 1 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 60 | c =-1
61 | #: E225 61 | #: E225
62 | x = x /2 - 1 62 | x = x /2 - 1
| E225 | ^ E225
63 | #: E225 63 | #: E225
64 | c = alpha -4 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 62 | x = x /2 - 1
63 | #: E225 63 | #: E225
64 | c = alpha -4 64 | c = alpha -4
| E225 | ^ E225
65 | #: E225 65 | #: E225
66 | c = alpha- 4 66 | c = alpha- 4
| |
@ -55,27 +55,27 @@ E22.py:64:10: E225 Missing whitespace around operator
64 | c = alpha -4 64 | c = alpha -4
65 | #: E225 65 | #: E225
66 | c = alpha- 4 66 | c = alpha- 4
| E225 | ^ E225
67 | #: E225 67 | #: E225
68 | z = x **y 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 66 | c = alpha- 4
67 | #: E225 67 | #: E225
68 | z = x **y 68 | z = x **y
| E225 | ^^ E225
69 | #: E225 69 | #: E225
70 | z = (x + 1) **y 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 68 | z = x **y
69 | #: E225 69 | #: E225
70 | z = (x + 1) **y 70 | z = (x + 1) **y
| E225 | ^^ E225
71 | #: E225 71 | #: E225
72 | z = (x + 1)** y 72 | z = (x + 1)** y
| |
@ -85,17 +85,17 @@ E22.py:70:12: E225 Missing whitespace around operator
70 | z = (x + 1) **y 70 | z = (x + 1) **y
71 | #: E225 71 | #: E225
72 | z = (x + 1)** y 72 | z = (x + 1)** y
| E225 | ^^ E225
73 | #: E225 73 | #: E225
74 | _1kB = _1MB >>10 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 72 | z = (x + 1)** y
73 | #: E225 73 | #: E225
74 | _1kB = _1MB >>10 74 | _1kB = _1MB >>10
| E225 | ^^ E225
75 | #: E225 75 | #: E225
76 | _1kB = _1MB>> 10 76 | _1kB = _1MB>> 10
| |
@ -105,7 +105,7 @@ E22.py:74:12: E225 Missing whitespace around operator
74 | _1kB = _1MB >>10 74 | _1kB = _1MB >>10
75 | #: E225 75 | #: E225
76 | _1kB = _1MB>> 10 76 | _1kB = _1MB>> 10
| E225 | ^^ E225
77 | #: E225 E225 77 | #: E225 E225
78 | i=i+ 1 78 | i=i+ 1
| |
@ -115,7 +115,7 @@ E22.py:76:2: E225 Missing whitespace around operator
76 | _1kB = _1MB>> 10 76 | _1kB = _1MB>> 10
77 | #: E225 E225 77 | #: E225 E225
78 | i=i+ 1 78 | i=i+ 1
| E225 | ^ E225
79 | #: E225 E225 79 | #: E225 E225
80 | i=i +1 80 | i=i +1
| |
@ -125,7 +125,7 @@ E22.py:76:4: E225 Missing whitespace around operator
76 | _1kB = _1MB>> 10 76 | _1kB = _1MB>> 10
77 | #: E225 E225 77 | #: E225 E225
78 | i=i+ 1 78 | i=i+ 1
| E225 | ^ E225
79 | #: E225 E225 79 | #: E225 E225
80 | i=i +1 80 | i=i +1
| |
@ -135,17 +135,17 @@ E22.py:78:2: E225 Missing whitespace around operator
78 | i=i+ 1 78 | i=i+ 1
79 | #: E225 E225 79 | #: E225 E225
80 | i=i +1 80 | i=i +1
| E225 | ^ E225
81 | #: E225 81 | #: E225
82 | i = 1and 1 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 78 | i=i+ 1
79 | #: E225 E225 79 | #: E225 E225
80 | i=i +1 80 | i=i +1
| E225 | ^ E225
81 | #: E225 81 | #: E225
82 | i = 1and 1 82 | i = 1and 1
| |
@ -155,7 +155,7 @@ E22.py:80:6: E225 Missing whitespace around operator
80 | i=i +1 80 | i=i +1
81 | #: E225 81 | #: E225
82 | i = 1and 1 82 | i = 1and 1
| E225 | ^^^ E225
83 | #: E225 83 | #: E225
84 | i = 1or 0 84 | i = 1or 0
| |
@ -165,7 +165,7 @@ E22.py:82:6: E225 Missing whitespace around operator
82 | i = 1and 1 82 | i = 1and 1
83 | #: E225 83 | #: E225
84 | i = 1or 0 84 | i = 1or 0
| E225 | ^^ E225
85 | #: E225 85 | #: E225
86 | 1is 1 86 | 1is 1
| |
@ -175,7 +175,7 @@ E22.py:84:2: E225 Missing whitespace around operator
84 | i = 1or 0 84 | i = 1or 0
85 | #: E225 85 | #: E225
86 | 1is 1 86 | 1is 1
| E225 | ^^ E225
87 | #: E225 87 | #: E225
88 | 1in [] 88 | 1in []
| |
@ -185,17 +185,17 @@ E22.py:86:2: E225 Missing whitespace around operator
86 | 1is 1 86 | 1is 1
87 | #: E225 87 | #: E225
88 | 1in [] 88 | 1in []
| E225 | ^^ E225
89 | #: E225 89 | #: E225
90 | i = 1 @2 90 | i = 1 @2
| |
E22.py:88:8: E225 Missing whitespace around operator E22.py:88:7: E225 Missing whitespace around operator
| |
88 | 1in [] 88 | 1in []
89 | #: E225 89 | #: E225
90 | i = 1 @2 90 | i = 1 @2
| E225 | ^ E225
91 | #: E225 91 | #: E225
92 | i = 1@ 2 92 | i = 1@ 2
| |
@ -205,7 +205,7 @@ E22.py:90:6: E225 Missing whitespace around operator
90 | i = 1 @2 90 | i = 1 @2
91 | #: E225 91 | #: E225
92 | i = 1@ 2 92 | i = 1@ 2
| E225 | ^ E225
93 | #: E225 E226 93 | #: E225 E226
94 | i=i+1 94 | i=i+1
| |
@ -215,17 +215,17 @@ E22.py:92:2: E225 Missing whitespace around operator
92 | i = 1@ 2 92 | i = 1@ 2
93 | #: E225 E226 93 | #: E225 E226
94 | i=i+1 94 | i=i+1
| E225 | ^ E225
95 | #: E225 E226 95 | #: E225 E226
96 | i =i+1 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 94 | i=i+1
95 | #: E225 E226 95 | #: E225 E226
96 | i =i+1 96 | i =i+1
| E225 | ^ E225
97 | #: E225 E226 97 | #: E225 E226
98 | i= i+1 98 | i= i+1
| |
@ -235,17 +235,17 @@ E22.py:96:2: E225 Missing whitespace around operator
96 | i =i+1 96 | i =i+1
97 | #: E225 E226 97 | #: E225 E226
98 | i= i+1 98 | i= i+1
| E225 | ^ E225
99 | #: E225 E226 99 | #: E225 E226
100 | c = (a +b)*(a - b) 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 98 | i= i+1
99 | #: E225 E226 99 | #: E225 E226
100 | c = (a +b)*(a - b) 100 | c = (a +b)*(a - b)
| E225 | ^ E225
101 | #: E225 E226 101 | #: E225 E226
102 | c = (a+ b)*(a - b) 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) 100 | c = (a +b)*(a - b)
101 | #: E225 E226 101 | #: E225 E226
102 | c = (a+ b)*(a - b) 102 | c = (a+ b)*(a - b)
| E225 | ^ E225
103 | #: 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)) 154 | func2(lambda a, b=h[:], c=0: (a, b, c))
155 | if not -5 < x < +5: 155 | if not -5 < x < +5:
156 | print >>sys.stderr, "x is out of range." 156 | print >>sys.stderr, "x is out of range."
| E225 | ^^ E225
157 | print >> sys.stdout, "x is an integer." 157 | print >> sys.stdout, "x is an integer."
158 | x = x / 2 - 1 158 | x = x / 2 - 1
| |

View file

@ -6,7 +6,7 @@ E22.py:92:4: E226 Missing whitespace around arithmetic operator
92 | i = 1@ 2 92 | i = 1@ 2
93 | #: E225 E226 93 | #: E225 E226
94 | i=i+1 94 | i=i+1
| E226 | ^ E226
95 | #: E225 E226 95 | #: E225 E226
96 | i =i+1 96 | i =i+1
| |
@ -16,7 +16,7 @@ E22.py:94:5: E226 Missing whitespace around arithmetic operator
94 | i=i+1 94 | i=i+1
95 | #: E225 E226 95 | #: E225 E226
96 | i =i+1 96 | i =i+1
| E226 | ^ E226
97 | #: E225 E226 97 | #: E225 E226
98 | i= i+1 98 | i= i+1
| |
@ -26,7 +26,7 @@ E22.py:96:5: E226 Missing whitespace around arithmetic operator
96 | i =i+1 96 | i =i+1
97 | #: E225 E226 97 | #: E225 E226
98 | i= i+1 98 | i= i+1
| E226 | ^ E226
99 | #: E225 E226 99 | #: E225 E226
100 | c = (a +b)*(a - b) 100 | c = (a +b)*(a - b)
| |
@ -36,7 +36,7 @@ E22.py:98:11: E226 Missing whitespace around arithmetic operator
98 | i= i+1 98 | i= i+1
99 | #: E225 E226 99 | #: E225 E226
100 | c = (a +b)*(a - b) 100 | c = (a +b)*(a - b)
| E226 | ^ E226
101 | #: E225 E226 101 | #: E225 E226
102 | c = (a+ b)*(a - b) 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) 100 | c = (a +b)*(a - b)
101 | #: E225 E226 101 | #: E225 E226
102 | c = (a+ b)*(a - b) 102 | c = (a+ b)*(a - b)
| E226 | ^ E226
103 | #: 103 | #:
| |
@ -54,7 +54,7 @@ E22.py:104:6: E226 Missing whitespace around arithmetic operator
| |
104 | #: E226 104 | #: E226
105 | z = 2//30 105 | z = 2//30
| E226 | ^^ E226
106 | #: E226 E226 106 | #: E226 E226
107 | c = (a+b) * (a-b) 107 | c = (a+b) * (a-b)
| |
@ -64,7 +64,7 @@ E22.py:106:7: E226 Missing whitespace around arithmetic operator
106 | z = 2//30 106 | z = 2//30
107 | #: E226 E226 107 | #: E226 E226
108 | c = (a+b) * (a-b) 108 | c = (a+b) * (a-b)
| E226 | ^ E226
109 | #: E226 109 | #: E226
110 | norman = True+False 110 | norman = True+False
| |
@ -74,7 +74,7 @@ E22.py:106:15: E226 Missing whitespace around arithmetic operator
106 | z = 2//30 106 | z = 2//30
107 | #: E226 E226 107 | #: E226 E226
108 | c = (a+b) * (a-b) 108 | c = (a+b) * (a-b)
| E226 | ^ E226
109 | #: E226 109 | #: E226
110 | norman = True+False 110 | norman = True+False
| |
@ -84,7 +84,7 @@ E22.py:110:6: E226 Missing whitespace around arithmetic operator
110 | norman = True+False 110 | norman = True+False
111 | #: E226 111 | #: E226
112 | x = x*2 - 1 112 | x = x*2 - 1
| E226 | ^ E226
113 | #: E226 113 | #: E226
114 | x = x/2 - 1 114 | x = x/2 - 1
| |
@ -94,7 +94,7 @@ E22.py:112:6: E226 Missing whitespace around arithmetic operator
112 | x = x*2 - 1 112 | x = x*2 - 1
113 | #: E226 113 | #: E226
114 | x = x/2 - 1 114 | x = x/2 - 1
| E226 | ^ E226
115 | #: E226 E226 115 | #: E226 E226
116 | hypot2 = x*x + y*y 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 114 | x = x/2 - 1
115 | #: E226 E226 115 | #: E226 E226
116 | hypot2 = x*x + y*y 116 | hypot2 = x*x + y*y
| E226 | ^ E226
117 | #: E226 117 | #: E226
118 | c = (a + b)*(a - b) 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 114 | x = x/2 - 1
115 | #: E226 E226 115 | #: E226 E226
116 | hypot2 = x*x + y*y 116 | hypot2 = x*x + y*y
| E226 | ^ E226
117 | #: E226 117 | #: E226
118 | c = (a + b)*(a - b) 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 116 | hypot2 = x*x + y*y
117 | #: E226 117 | #: E226
118 | c = (a + b)*(a - b) 118 | c = (a + b)*(a - b)
| E226 | ^ E226
119 | #: E226 119 | #: E226
120 | def halves(n): 120 | def halves(n):
| |
@ -134,7 +134,7 @@ E22.py:119:14: E226 Missing whitespace around arithmetic operator
119 | #: E226 119 | #: E226
120 | def halves(n): 120 | def halves(n):
121 | return (i//2 for i in range(n)) 121 | return (i//2 for i in range(n))
| E226 | ^^ E226
122 | #: E227 122 | #: E227
123 | _1kB = _1MB>>10 123 | _1kB = _1MB>>10
| |

View file

@ -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)) 121 | return (i//2 for i in range(n))
122 | #: E227 122 | #: E227
123 | _1kB = _1MB>>10 123 | _1kB = _1MB>>10
| E227 | ^^ E227
124 | #: E227 124 | #: E227
125 | _1MB = _1kB<<10 125 | _1MB = _1kB<<10
| |
@ -16,7 +16,7 @@ E22.py:123:12: E227 Missing whitespace around bitwise or shift operator
123 | _1kB = _1MB>>10 123 | _1kB = _1MB>>10
124 | #: E227 124 | #: E227
125 | _1MB = _1kB<<10 125 | _1MB = _1kB<<10
| E227 | ^^ E227
126 | #: E227 126 | #: E227
127 | a = b|c 127 | a = b|c
| |
@ -26,7 +26,7 @@ E22.py:125:6: E227 Missing whitespace around bitwise or shift operator
125 | _1MB = _1kB<<10 125 | _1MB = _1kB<<10
126 | #: E227 126 | #: E227
127 | a = b|c 127 | a = b|c
| E227 | ^ E227
128 | #: E227 128 | #: E227
129 | b = c&a 129 | b = c&a
| |
@ -36,7 +36,7 @@ E22.py:127:6: E227 Missing whitespace around bitwise or shift operator
127 | a = b|c 127 | a = b|c
128 | #: E227 128 | #: E227
129 | b = c&a 129 | b = c&a
| E227 | ^ E227
130 | #: E227 130 | #: E227
131 | c = b^a 131 | c = b^a
| |
@ -46,7 +46,7 @@ E22.py:129:6: E227 Missing whitespace around bitwise or shift operator
129 | b = c&a 129 | b = c&a
130 | #: E227 130 | #: E227
131 | c = b^a 131 | c = b^a
| E227 | ^ E227
132 | #: E228 132 | #: E228
133 | a = b%c 133 | a = b%c
| |

View file

@ -6,7 +6,7 @@ E22.py:131:6: E228 Missing whitespace around modulo operator
131 | c = b^a 131 | c = b^a
132 | #: E228 132 | #: E228
133 | a = b%c 133 | a = b%c
| E228 | ^ E228
134 | #: E228 134 | #: E228
135 | msg = fmt%(errno, errmsg) 135 | msg = fmt%(errno, errmsg)
| |
@ -16,7 +16,7 @@ E22.py:133:10: E228 Missing whitespace around modulo operator
133 | a = b%c 133 | a = b%c
134 | #: E228 134 | #: E228
135 | msg = fmt%(errno, errmsg) 135 | msg = fmt%(errno, errmsg)
| E228 | ^ E228
136 | #: E228 136 | #: E228
137 | msg = "Error %d occurred"%errno 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) 135 | msg = fmt%(errno, errmsg)
136 | #: E228 136 | #: E228
137 | msg = "Error %d occurred"%errno 137 | msg = "Error %d occurred"%errno
| E228 | ^ E228
138 | #: 138 | #:
| |

View file

@ -5,7 +5,7 @@ E23.py:2:7: E231 [*] Missing whitespace after ','
| |
2 | #: E231 2 | #: E231
3 | a = (1,2) 3 | a = (1,2)
| E231 | ^ E231
4 | #: E231 4 | #: E231
5 | a[b1,:] 5 | a[b1,:]
| |
@ -24,7 +24,7 @@ E23.py:4:5: E231 [*] Missing whitespace after ','
4 | a = (1,2) 4 | a = (1,2)
5 | #: E231 5 | #: E231
6 | a[b1,:] 6 | a[b1,:]
| E231 | ^ E231
7 | #: E231 7 | #: E231
8 | a = [{'a':''}] 8 | a = [{'a':''}]
| |
@ -45,7 +45,7 @@ E23.py:6:10: E231 [*] Missing whitespace after ':'
6 | a[b1,:] 6 | a[b1,:]
7 | #: E231 7 | #: E231
8 | a = [{'a':''}] 8 | a = [{'a':''}]
| E231 | ^ E231
9 | #: Okay 9 | #: Okay
10 | a = (4,) 10 | a = (4,)
| |
@ -66,7 +66,7 @@ E23.py:19:10: E231 [*] Missing whitespace after ','
19 | def foo() -> None: 19 | def foo() -> None:
20 | #: E231 20 | #: E231
21 | if (1,2): 21 | if (1,2):
| E231 | ^ E231
22 | pass 22 | pass
| |
= help: Added missing whitespace after ',' = help: Added missing whitespace after ','

View file

@ -5,7 +5,7 @@ E25.py:2:12: E251 Unexpected spaces around keyword / parameter equals
| |
2 | #: E251 E251 2 | #: E251 E251
3 | def foo(bar = False): 3 | def foo(bar = False):
| E251 | ^ E251
4 | '''Test function with an error in declaration''' 4 | '''Test function with an error in declaration'''
5 | pass 5 | pass
| |
@ -14,7 +14,7 @@ E25.py:2:14: E251 Unexpected spaces around keyword / parameter equals
| |
2 | #: E251 E251 2 | #: E251 E251
3 | def foo(bar = False): 3 | def foo(bar = False):
| E251 | ^ E251
4 | '''Test function with an error in declaration''' 4 | '''Test function with an error in declaration'''
5 | pass 5 | pass
| |
@ -24,7 +24,7 @@ E25.py:6:9: E251 Unexpected spaces around keyword / parameter equals
6 | pass 6 | pass
7 | #: E251 7 | #: E251
8 | foo(bar= True) 8 | foo(bar= True)
| E251 | ^ E251
9 | #: E251 9 | #: E251
10 | foo(bar =True) 10 | foo(bar =True)
| |
@ -34,7 +34,7 @@ E25.py:8:8: E251 Unexpected spaces around keyword / parameter equals
8 | foo(bar= True) 8 | foo(bar= True)
9 | #: E251 9 | #: E251
10 | foo(bar =True) 10 | foo(bar =True)
| E251 | ^ E251
11 | #: E251 E251 11 | #: E251 E251
12 | foo(bar = True) 12 | foo(bar = True)
| |
@ -44,7 +44,7 @@ E25.py:10:8: E251 Unexpected spaces around keyword / parameter equals
10 | foo(bar =True) 10 | foo(bar =True)
11 | #: E251 E251 11 | #: E251 E251
12 | foo(bar = True) 12 | foo(bar = True)
| E251 | ^ E251
13 | #: E251 13 | #: E251
14 | y = bar(root= "sdasd") 14 | y = bar(root= "sdasd")
| |
@ -54,7 +54,7 @@ E25.py:10:10: E251 Unexpected spaces around keyword / parameter equals
10 | foo(bar =True) 10 | foo(bar =True)
11 | #: E251 E251 11 | #: E251 E251
12 | foo(bar = True) 12 | foo(bar = True)
| E251 | ^ E251
13 | #: E251 13 | #: E251
14 | y = bar(root= "sdasd") 14 | y = bar(root= "sdasd")
| |
@ -64,29 +64,33 @@ E25.py:12:14: E251 Unexpected spaces around keyword / parameter equals
12 | foo(bar = True) 12 | foo(bar = True)
13 | #: E251 13 | #: E251
14 | y = bar(root= "sdasd") 14 | y = bar(root= "sdasd")
| E251 | ^ E251
15 | #: E251:2:29 15 | #: E251:2:29
16 | parser.add_argument('--long-option', 16 | parser.add_argument('--long-option',
| |
E25.py:15:29: E251 Unexpected spaces around keyword / parameter equals E25.py:15:29: E251 Unexpected spaces around keyword / parameter equals
| |
15 | #: E251:2:29 15 | #: E251:2:29
16 | parser.add_argument('--long-option', 16 | parser.add_argument('--long-option',
17 | default= 17 | default=
| E251 | _____________________________^
18 | "/rather/long/filesystem/path/here/blah/blah/blah") 18 | | "/rather/long/filesystem/path/here/blah/blah/blah")
19 | #: E251:1:45 | |____________________^ E251
19 | #: E251:1:45
20 | parser.add_argument('--long-option', default
| |
E25.py:18:45: E251 Unexpected spaces around keyword / parameter equals E25.py:18:45: E251 Unexpected spaces around keyword / parameter equals
| |
18 | "/rather/long/filesystem/path/here/blah/blah/blah") 18 | "/rather/long/filesystem/path/here/blah/blah/blah")
19 | #: E251:1:45 19 | #: E251:1:45
20 | parser.add_argument('--long-option', default 20 | parser.add_argument('--long-option', default
| E251 | _____________________________________________^
21 | ="/rather/long/filesystem/path/here/blah/blah/blah") 21 | | ="/rather/long/filesystem/path/here/blah/blah/blah")
22 | #: E251:3:8 E251:3:10 | |____________________^ E251
22 | #: E251:3:8 E251:3:10
23 | foo(True,
| |
E25.py:23:8: E251 Unexpected spaces around keyword / parameter equals 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, 23 | foo(True,
24 | baz=(1, 2), 24 | baz=(1, 2),
25 | biz = 'foo' 25 | biz = 'foo'
| E251 | ^ E251
26 | ) 26 | )
27 | #: Okay 27 | #: Okay
| |
@ -104,7 +108,7 @@ E25.py:23:10: E251 Unexpected spaces around keyword / parameter equals
23 | foo(True, 23 | foo(True,
24 | baz=(1, 2), 24 | baz=(1, 2),
25 | biz = 'foo' 25 | biz = 'foo'
| E251 | ^ E251
26 | ) 26 | )
27 | #: Okay 27 | #: Okay
| |

View file

@ -6,27 +6,27 @@ E25.py:46:15: E252 Missing whitespace around parameter equals
46 | return a + b 46 | return a + b
47 | #: E252:1:15 E252:1:16 E252:1:27 E252:1:36 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: 48 | def add(a: int=0, b: int =0, c: int= 0) -> int:
| E252 | ^ E252
49 | return a + b + c 49 | return a + b + c
50 | #: Okay 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 46 | return a + b
47 | #: E252:1:15 E252:1:16 E252:1:27 E252:1:36 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: 48 | def add(a: int=0, b: int =0, c: int= 0) -> int:
| E252 | ^ E252
49 | return a + b + c 49 | return a + b + c
50 | #: Okay 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 46 | return a + b
47 | #: E252:1:15 E252:1:16 E252:1:27 E252:1:36 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: 48 | def add(a: int=0, b: int =0, c: int= 0) -> int:
| E252 | ^ E252
49 | return a + b + c 49 | return a + b + c
50 | #: Okay 50 | #: Okay
| |
@ -36,7 +36,7 @@ E25.py:46:36: E252 Missing whitespace around parameter equals
46 | return a + b 46 | return a + b
47 | #: E252:1:15 E252:1:16 E252:1:27 E252:1:36 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: 48 | def add(a: int=0, b: int =0, c: int= 0) -> int:
| E252 | ^ E252
49 | return a + b + c 49 | return a + b + c
50 | #: Okay 50 | #: Okay
| |

View file

@ -6,7 +6,7 @@ E27.py:4:9: E271 Multiple spaces after keyword
4 | True and False 4 | True and False
5 | #: E271 5 | #: E271
6 | True and False 6 | True and False
| E271 | ^^ E271
7 | #: E272 7 | #: E272
8 | True and False 8 | True and False
| |
@ -16,7 +16,7 @@ E27.py:6:5: E271 Multiple spaces after keyword
6 | True and False 6 | True and False
7 | #: E272 7 | #: E272
8 | True and False 8 | True and False
| E271 | ^^ E271
9 | #: E271 9 | #: E271
10 | if 1: 10 | if 1:
| |
@ -26,7 +26,7 @@ E27.py:8:3: E271 Multiple spaces after keyword
8 | True and False 8 | True and False
9 | #: E271 9 | #: E271
10 | if 1: 10 | if 1:
| E271 | ^^^ E271
11 | #: E273 11 | #: E273
12 | True and False 12 | True and False
| |
@ -36,7 +36,7 @@ E27.py:14:6: E271 Multiple spaces after keyword
14 | True and False 14 | True and False
15 | #: E271 15 | #: E271
16 | a and b 16 | a and b
| E271 | ^^ E271
17 | #: E271 17 | #: E271
18 | 1 and b 18 | 1 and b
| |
@ -46,7 +46,7 @@ E27.py:16:6: E271 Multiple spaces after keyword
16 | a and b 16 | a and b
17 | #: E271 17 | #: E271
18 | 1 and b 18 | 1 and b
| E271 | ^^ E271
19 | #: E271 19 | #: E271
20 | a and 2 20 | a and 2
| |
@ -56,7 +56,7 @@ E27.py:18:6: E271 Multiple spaces after keyword
18 | 1 and b 18 | 1 and b
19 | #: E271 19 | #: E271
20 | a and 2 20 | a and 2
| E271 | ^^ E271
21 | #: E271 E272 21 | #: E271 E272
22 | 1 and b 22 | 1 and b
| |
@ -66,7 +66,7 @@ E27.py:20:7: E271 Multiple spaces after keyword
20 | a and 2 20 | a and 2
21 | #: E271 E272 21 | #: E271 E272
22 | 1 and b 22 | 1 and b
| E271 | ^^ E271
23 | #: E271 E272 23 | #: E271 E272
24 | a and 2 24 | a and 2
| |
@ -76,7 +76,7 @@ E27.py:22:7: E271 Multiple spaces after keyword
22 | 1 and b 22 | 1 and b
23 | #: E271 E272 23 | #: E271 E272
24 | a and 2 24 | a and 2
| E271 | ^^ E271
25 | #: E272 25 | #: E272
26 | this and False 26 | this and False
| |
@ -86,7 +86,7 @@ E27.py:35:14: E271 Multiple spaces after keyword
35 | from v import c, d 35 | from v import c, d
36 | #: E271 36 | #: E271
37 | from w import (e, f) 37 | from w import (e, f)
| E271 | ^^ E271
38 | #: E275 38 | #: E275
39 | from w import(e, f) 39 | from w import(e, f)
| |

View file

@ -6,7 +6,7 @@ E27.py:20:2: E272 Multiple spaces before keyword
20 | a and 2 20 | a and 2
21 | #: E271 E272 21 | #: E271 E272
22 | 1 and b 22 | 1 and b
| E272 | ^^ E272
23 | #: E271 E272 23 | #: E271 E272
24 | a and 2 24 | a and 2
| |
@ -16,7 +16,7 @@ E27.py:22:2: E272 Multiple spaces before keyword
22 | 1 and b 22 | 1 and b
23 | #: E271 E272 23 | #: E271 E272
24 | a and 2 24 | a and 2
| E272 | ^^ E272
25 | #: E272 25 | #: E272
26 | this and False 26 | this and False
| |
@ -26,7 +26,7 @@ E27.py:24:5: E272 Multiple spaces before keyword
24 | a and 2 24 | a and 2
25 | #: E272 25 | #: E272
26 | this and False 26 | this and False
| E272 | ^^ E272
27 | #: E273 27 | #: E273
28 | a and b 28 | a and b
| |

View file

@ -6,7 +6,7 @@ E27.py:10:9: E273 Tab after keyword
10 | if 1: 10 | if 1:
11 | #: E273 11 | #: E273
12 | True and False 12 | True and False
| E273 | ^^^^^^^^ E273
13 | #: E273 E274 13 | #: E273 E274
14 | True and False 14 | True and False
| |
@ -16,7 +16,7 @@ E27.py:12:5: E273 Tab after keyword
12 | True and False 12 | True and False
13 | #: E273 E274 13 | #: E273 E274
14 | True and False 14 | True and False
| E273 | ^^^^^^^^ E273
15 | #: E271 15 | #: E271
16 | a and b 16 | a and b
| |
@ -26,7 +26,7 @@ E27.py:12:10: E273 Tab after keyword
12 | True and False 12 | True and False
13 | #: E273 E274 13 | #: E273 E274
14 | True and False 14 | True and False
| E273 | ^ E273
15 | #: E271 15 | #: E271
16 | a and b 16 | a and b
| |
@ -36,7 +36,7 @@ E27.py:26:6: E273 Tab after keyword
26 | this and False 26 | this and False
27 | #: E273 27 | #: E273
28 | a and b 28 | a and b
| E273 | ^^^ E273
29 | #: E274 29 | #: E274
30 | a and b 30 | a and b
| |
@ -46,7 +46,7 @@ E27.py:30:10: E273 Tab after keyword
30 | a and b 30 | a and b
31 | #: E273 E274 31 | #: E273 E274
32 | this and False 32 | this and False
| E273 | ^ E273
33 | #: Okay 33 | #: Okay
34 | from u import (a, b) 34 | from u import (a, b)
| |

View file

@ -1,22 +1,22 @@
--- ---
source: crates/ruff/src/rules/pycodestyle/mod.rs 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 28 | a and b
29 | #: E274 29 | #: E274
30 | a and b 30 | a and b
| E274 | ^^^^^^^ E274
31 | #: E273 E274 31 | #: E273 E274
32 | this and False 32 | this and False
| |
E27.py:30:6: E274 Tab before keyword E27.py:30:5: E274 Tab before keyword
| |
30 | a and b 30 | a and b
31 | #: E273 E274 31 | #: E273 E274
32 | this and False 32 | this and False
| E274 | ^^^^^^^^ E274
33 | #: Okay 33 | #: Okay
34 | from u import (a, b) 34 | from u import (a, b)
| |

View file

@ -1,52 +1,52 @@
--- ---
source: crates/ruff/src/rules/pycodestyle/mod.rs 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) 37 | from w import (e, f)
38 | #: E275 38 | #: E275
39 | from w import(e, f) 39 | from w import(e, f)
| E275 | ^^^^^^ E275
40 | #: E275 40 | #: E275
41 | from importable.module import(e, f) 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) 39 | from w import(e, f)
40 | #: E275 40 | #: E275
41 | from importable.module import(e, f) 41 | from importable.module import(e, f)
| E275 | ^^^^^^ E275
42 | #: E275 42 | #: E275
43 | try: 43 | try:
| |
E27.py:42:34: E275 Missing whitespace after keyword E27.py:42:28: E275 Missing whitespace after keyword
| |
42 | #: E275 42 | #: E275
43 | try: 43 | try:
44 | from importable.module import(e, f) 44 | from importable.module import(e, f)
| E275 | ^^^^^^ E275
45 | except ImportError: 45 | except ImportError:
46 | pass 46 | pass
| |
E27.py:46:3: E275 Missing whitespace after keyword E27.py:46:1: E275 Missing whitespace after keyword
| |
46 | pass 46 | pass
47 | #: E275 47 | #: E275
48 | if(foo): 48 | if(foo):
| E275 | ^^ E275
49 | pass 49 | pass
50 | else: 50 | else:
| |
E27.py:54:11: E275 Missing whitespace after keyword E27.py:54:5: E275 Missing whitespace after keyword
| |
54 | #: E275:2:11 54 | #: E275:2:11
55 | if True: 55 | if True:
56 | assert(1) 56 | assert(1)
| E275 | ^^^^^^ E275
57 | #: Okay 57 | #: Okay
58 | def f(): 58 | def f():
| |