From 554869d5841b80799c5bcd477434c1139c09cedc Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Thu, 27 Apr 2023 07:35:13 -0700 Subject: [PATCH] Render tabs as 4 spaces in diagnostics --- crates/ruff/src/message/text.rs | 58 ++++- ...les__pycodestyle__tests__E101_E101.py.snap | 12 +- ...ules__pycodestyle__tests__E117_E11.py.snap | 4 +- ...ules__pycodestyle__tests__E201_E20.py.snap | 16 +- ...ules__pycodestyle__tests__E202_E20.py.snap | 16 +- ...ules__pycodestyle__tests__E203_E20.py.snap | 6 +- ...ules__pycodestyle__tests__E223_E22.py.snap | 2 +- ...ules__pycodestyle__tests__E224_E22.py.snap | 2 +- ...ules__pycodestyle__tests__E271_E27.py.snap | 4 +- ...ules__pycodestyle__tests__E272_E27.py.snap | 2 +- ...ules__pycodestyle__tests__E273_E27.py.snap | 24 +- ...ules__pycodestyle__tests__E274_E27.py.snap | 14 +- ...ules__pycodestyle__tests__W191_W19.py.snap | 228 +++++++++--------- 13 files changed, 212 insertions(+), 176 deletions(-) diff --git a/crates/ruff/src/message/text.rs b/crates/ruff/src/message/text.rs index c0801a3ce6f8dc..ba2cea4d300413 100644 --- a/crates/ruff/src/message/text.rs +++ b/crates/ruff/src/message/text.rs @@ -8,7 +8,8 @@ use bitflags::bitflags; use colored::Colorize; use ruff_diagnostics::DiagnosticKind; use ruff_python_ast::source_code::{OneIndexed, SourceLocation}; -use ruff_text_size::TextRange; +use ruff_text_size::{TextRange, TextSize}; +use std::borrow::Cow; use std::fmt::{Display, Formatter}; use std::io::Write; @@ -172,6 +173,7 @@ impl Display for MessageCodeFrame<'_> { }; let source_code = file.to_source_code(); + let content_start_index = source_code.line_index(range.start()); let mut start_index = content_start_index.saturating_sub(2); @@ -200,26 +202,23 @@ impl Display for MessageCodeFrame<'_> { let start_offset = source_code.line_start(start_index); let end_offset = source_code.line_end(end_index); - let source_text = source_code.slice(TextRange::new(start_offset, end_offset)); - - let annotation_start_offset = range.start() - start_offset; - let annotation_end_offset = range.end() - start_offset; + let source = replace_whitespace( + source_code.slice(TextRange::new(start_offset, end_offset)), + range - start_offset, + ); - let start_char = source_text[TextRange::up_to(annotation_start_offset)] + let start_char = source.text[TextRange::up_to(source.annotation_range.start())] .chars() .count(); - let char_length = source_text - [TextRange::new(annotation_start_offset, annotation_end_offset)] - .chars() - .count(); + let char_length = source.text[source.annotation_range].chars().count(); let label = kind.rule().noqa_code().to_string(); let snippet = Snippet { title: None, slices: vec![Slice { - source: source_text, + source: &source.text, line_start: content_start_index.get(), annotations: vec![SourceAnnotation { label: &label, @@ -245,6 +244,43 @@ impl Display for MessageCodeFrame<'_> { } } +fn replace_whitespace(source: &str, annotation_range: TextRange) -> SourceCode { + let mut result = String::new(); + let mut last_end = 0; + let mut range = annotation_range; + + for (index, _) in source.match_indices('\t') { + if index < usize::from(annotation_range.start()) { + range += TextSize::new(3); + } else if index < usize::from(annotation_range.end()) { + range = range.add_end(TextSize::new(3)); + } + + result.push_str(&source[last_end..index]); + result.push_str(" "); + last_end = index + 1; + } + + // No tabs + if result.is_empty() { + SourceCode { + annotation_range, + text: Cow::Borrowed(source), + } + } else { + result.push_str(&source[last_end..]); + SourceCode { + annotation_range: range, + text: Cow::Owned(result), + } + } +} + +struct SourceCode<'a> { + text: Cow<'a, str>, + annotation_range: TextRange, +} + #[cfg(test)] mod tests { use crate::message::tests::{capture_emitter_output, create_messages}; diff --git a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E101_E101.py.snap b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E101_E101.py.snap index 754f1c42a2a1d5..d1b7d11aee8f32 100644 --- a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E101_E101.py.snap +++ b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E101_E101.py.snap @@ -5,8 +5,8 @@ E101.py:11:1: E101 Indentation contains mixed spaces and tabs | 11 | def func_mixed_start_with_tab(): 12 | # E101 -13 | print("mixed starts with tab") - | ^^ E101 +13 | print("mixed starts with tab") + | ^^^^^^ E101 14 | 15 | def func_mixed_start_with_space(): | @@ -15,8 +15,8 @@ E101.py:15:1: E101 Indentation contains mixed spaces and tabs | 15 | def func_mixed_start_with_space(): 16 | # E101 -17 | print("mixed starts with space") - | ^^^^^^^^ E101 +17 | print("mixed starts with space") + | ^^^^^^^^^^^^^^^^^^^^ E101 18 | 19 | def xyz(): | @@ -25,8 +25,8 @@ E101.py:19:1: E101 Indentation contains mixed spaces and tabs | 19 | def xyz(): 20 | # E101 -21 | print("xyz"); - | ^^^ E101 +21 | print("xyz"); + | ^^^^^^^ E101 | diff --git a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E117_E11.py.snap b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E117_E11.py.snap index fa8f00ee24f4b9..c3b25d40f40f63 100644 --- a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E117_E11.py.snap +++ b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__E117_E11.py.snap @@ -25,8 +25,8 @@ E11.py:42:1: E117 Over-indented | 42 | #: E117 W191 43 | def start(): -44 | print() - | E117 +44 | print() + | ^^^^^^^^ E117 | 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 65ff9adf5c091f..198479926f3aa5 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 @@ -27,34 +27,34 @@ E20.py:6:15: E201 Whitespace after '(' 8 | spam(ham[1], { eggs: 2}) | E201 9 | #: E201:1:6 -10 | spam( ham[1], {eggs: 2}) +10 | spam( ham[1], {eggs: 2}) | E20.py:8:6: E201 Whitespace after '(' | 8 | spam(ham[1], { eggs: 2}) 9 | #: E201:1:6 -10 | spam( ham[1], {eggs: 2}) +10 | spam( ham[1], {eggs: 2}) | E201 11 | #: E201:1:10 -12 | spam(ham[ 1], {eggs: 2}) +12 | spam(ham[ 1], {eggs: 2}) | E20.py:10:10: E201 Whitespace after '(' | -10 | spam( ham[1], {eggs: 2}) +10 | spam( ham[1], {eggs: 2}) 11 | #: E201:1:10 -12 | spam(ham[ 1], {eggs: 2}) +12 | spam(ham[ 1], {eggs: 2}) | E201 13 | #: E201:1:15 -14 | spam(ham[1], { eggs: 2}) +14 | spam(ham[1], { eggs: 2}) | E20.py:12:15: E201 Whitespace after '(' | -12 | spam(ham[ 1], {eggs: 2}) +12 | spam(ham[ 1], {eggs: 2}) 13 | #: E201:1:15 -14 | spam(ham[1], { eggs: 2}) +14 | spam(ham[1], { eggs: 2}) | 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 022fe459940486..1215dbb53bb98a 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 @@ -27,34 +27,34 @@ E20.py:23:11: E202 Whitespace before ')' 25 | spam(ham[1 ], {eggs: 2}) | E202 26 | #: E202:1:23 -27 | spam(ham[1], {eggs: 2} ) +27 | spam(ham[1], {eggs: 2} ) | E20.py:25:23: E202 Whitespace before ')' | 25 | spam(ham[1 ], {eggs: 2}) 26 | #: E202:1:23 -27 | spam(ham[1], {eggs: 2} ) +27 | spam(ham[1], {eggs: 2} ) | E202 28 | #: E202:1:22 -29 | spam(ham[1], {eggs: 2 }) +29 | spam(ham[1], {eggs: 2 }) | E20.py:27:22: E202 Whitespace before ')' | -27 | spam(ham[1], {eggs: 2} ) +27 | spam(ham[1], {eggs: 2} ) 28 | #: E202:1:22 -29 | spam(ham[1], {eggs: 2 }) +29 | spam(ham[1], {eggs: 2 }) | E202 30 | #: E202:1:11 -31 | spam(ham[1 ], {eggs: 2}) +31 | spam(ham[1 ], {eggs: 2}) | E20.py:29:11: E202 Whitespace before ')' | -29 | spam(ham[1], {eggs: 2 }) +29 | spam(ham[1], {eggs: 2 }) 30 | #: E202:1:11 -31 | spam(ham[1 ], {eggs: 2}) +31 | spam(ham[1 ], {eggs: 2}) | 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 4f2d7c1c22a630..b59e240bd7f461 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 @@ -14,7 +14,7 @@ E20.py:55:10: E203 Whitespace before ',', ';', or ':' | 55 | x, y = y, x 56 | #: E203:1:10 -57 | if x == 4 : +57 | if x == 4 : | E203 58 | print x, y 59 | x, y = y, x @@ -34,7 +34,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 +65 | print x, y ; x, y = y, x | E203 66 | #: E203:3:13 67 | if x == 4: @@ -54,7 +54,7 @@ E20.py:71:13: E203 Whitespace before ',', ';', or ':' | 71 | if x == 4: 72 | print x, y -73 | x, y = y , x +73 | x, y = y , x | E203 74 | #: Okay 75 | if x == 4: 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 fad6ed31336719..0e7405603f814f 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 @@ -5,7 +5,7 @@ E22.py:43:2: E223 Tab before operator | 43 | #: E223 44 | foobart = 4 -45 | a = 3 # aligned with tab +45 | a = 3 # aligned with tab | 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 cdb3d18aa44ca3..a8344802ea318e 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 @@ -4,7 +4,7 @@ source: crates/ruff/src/rules/pycodestyle/mod.rs E22.py:48:5: E224 Tab after operator | 48 | #: E224 -49 | a += 1 +49 | a += 1 | E224 50 | b += 1000 51 | #: 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 b05c7d68b0bae1..af6e1e52f0b063 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 @@ -28,12 +28,12 @@ E27.py:8:3: E271 Multiple spaces after keyword 10 | if 1: | E271 11 | #: E273 -12 | True and False +12 | True and False | E27.py:14:6: E271 Multiple spaces after keyword | -14 | True and False +14 | True and False 15 | #: E271 16 | a and b | E271 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 fa61e8f61fa3fd..1bc20e60e5be32 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 @@ -28,7 +28,7 @@ E27.py:24:5: E272 Multiple spaces before keyword 26 | this and False | E272 27 | #: E273 -28 | a and b +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 9fefdace978da9..87dce5836355a9 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 @@ -5,17 +5,17 @@ E27.py:10:9: E273 Tab after keyword | 10 | if 1: 11 | #: E273 -12 | True and False +12 | True and False | E273 13 | #: E273 E274 -14 | True and False +14 | True and False | E27.py:12:5: E273 Tab after keyword | -12 | True and False +12 | True and False 13 | #: E273 E274 -14 | True and False +14 | True and False | E273 15 | #: E271 16 | a and b @@ -23,10 +23,10 @@ E27.py:12:5: E273 Tab after keyword E27.py:12:10: E273 Tab after keyword | -12 | True and False +12 | True and False 13 | #: E273 E274 -14 | True and False - | E273 +14 | True and False + | E273 15 | #: E271 16 | a and b | @@ -35,18 +35,18 @@ E27.py:26:6: E273 Tab after keyword | 26 | this and False 27 | #: E273 -28 | a and b +28 | a and b | E273 29 | #: E274 -30 | a and b +30 | a and b | E27.py:30:10: E273 Tab after keyword | -30 | a and b +30 | a and b 31 | #: E273 E274 -32 | this and False - | E273 +32 | this and False + | 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 9adc314ea51301..1150a45c696c7b 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 @@ -3,20 +3,20 @@ source: crates/ruff/src/rules/pycodestyle/mod.rs --- E27.py:28:3: E274 Tab before keyword | -28 | a and b +28 | a and b 29 | #: E274 -30 | a and b - | E274 +30 | a and b + | E274 31 | #: E273 E274 -32 | this and False +32 | this and False | E27.py:30:6: E274 Tab before keyword | -30 | a and b +30 | a and b 31 | #: E273 E274 -32 | this and False - | E274 +32 | this and False + | E274 33 | #: Okay 34 | from u import (a, b) | diff --git a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__W191_W19.py.snap b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__W191_W19.py.snap index 1dd9828f0500dd..949a97f1bced48 100644 --- a/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__W191_W19.py.snap +++ b/crates/ruff/src/rules/pycodestyle/snapshots/ruff__rules__pycodestyle__tests__W191_W19.py.snap @@ -5,8 +5,8 @@ W19.py:3:1: W191 Indentation contains tabs | 3 | #: W191 4 | if False: -5 | print # indented with 1 tab - | W191 +5 | print # indented with 1 tab + | ^^^^ W191 6 | #: | @@ -14,8 +14,8 @@ W19.py:9:1: W191 Indentation contains tabs | 9 | #: W191 10 | y = x == 2 \ -11 | or x == 3 - | W191 +11 | or x == 3 + | ^^^^ W191 12 | #: E101 W191 W504 13 | if ( | @@ -24,8 +24,8 @@ W19.py:16:1: W191 Indentation contains tabs | 16 | ) or 17 | y == 4): -18 | pass - | W191 +18 | pass + | ^^^^ W191 19 | #: E101 W191 20 | if x == 2 \ | @@ -34,8 +34,8 @@ W19.py:21:1: W191 Indentation contains tabs | 21 | or y > 1 \ 22 | or x == 3: -23 | pass - | W191 +23 | pass + | ^^^^ W191 24 | #: E101 W191 25 | if x == 2 \ | @@ -44,8 +44,8 @@ W19.py:26:1: W191 Indentation contains tabs | 26 | or y > 1 \ 27 | or x == 3: -28 | pass - | W191 +28 | pass + | ^^^^ W191 29 | #: | @@ -53,8 +53,8 @@ W19.py:32:1: W191 Indentation contains tabs | 32 | if (foo == bar and 33 | baz == bop): -34 | pass - | W191 +34 | pass + | ^^^^ W191 35 | #: E101 W191 W504 36 | if ( | @@ -63,8 +63,8 @@ W19.py:38:1: W191 Indentation contains tabs | 38 | baz == bop 39 | ): -40 | pass - | W191 +40 | pass + | ^^^^ W191 41 | #: | @@ -72,18 +72,18 @@ W19.py:44:1: W191 Indentation contains tabs | 44 | if start[1] > end_col and not ( 45 | over_indent == 4 and indent_next): -46 | return (0, "E121 continuation line over-" - | W191 -47 | "indented for visual indent") +46 | return (0, "E121 continuation line over-" + | ^^^^ W191 +47 | "indented for visual indent") 48 | #: | W19.py:45:1: W191 Indentation contains tabs | 45 | over_indent == 4 and indent_next): -46 | return (0, "E121 continuation line over-" -47 | "indented for visual indent") - | ^^^^^^^^ W191 +46 | return (0, "E121 continuation line over-" +47 | "indented for visual indent") + | ^^^^^^^^^^^^ W191 48 | #: | @@ -91,8 +91,8 @@ W19.py:54:1: W191 Indentation contains tabs | 54 | var_one, var_two, var_three, 55 | var_four): -56 | print(var_one) - | W191 +56 | print(var_one) + | ^^^^ W191 57 | #: E101 W191 W504 58 | if ((row < 0 or self.moduleCount <= row or | @@ -101,8 +101,8 @@ W19.py:58:1: W191 Indentation contains tabs | 58 | if ((row < 0 or self.moduleCount <= row or 59 | col < 0 or self.moduleCount <= col)): -60 | raise Exception("%s,%s - %s" % (row, col, self.moduleCount)) - | W191 +60 | raise Exception("%s,%s - %s" % (row, col, self.moduleCount)) + | ^^^^ W191 61 | #: E101 E101 E101 E101 W191 W191 W191 W191 W191 W191 62 | if bar: | @@ -111,58 +111,58 @@ W19.py:61:1: W191 Indentation contains tabs | 61 | #: E101 E101 E101 E101 W191 W191 W191 W191 W191 W191 62 | if bar: -63 | return ( - | W191 -64 | start, 'E121 lines starting with a ' -65 | 'closing bracket should be indented ' +63 | return ( + | ^^^^ W191 +64 | start, 'E121 lines starting with a ' +65 | 'closing bracket should be indented ' | W19.py:62:1: W191 Indentation contains tabs | 62 | if bar: -63 | return ( -64 | start, 'E121 lines starting with a ' - | ^^^^ W191 -65 | 'closing bracket should be indented ' -66 | "to match that of the opening " +63 | return ( +64 | start, 'E121 lines starting with a ' + | ^^^^^^^^ W191 +65 | 'closing bracket should be indented ' +66 | "to match that of the opening " | W19.py:63:1: W191 Indentation contains tabs | -63 | return ( -64 | start, 'E121 lines starting with a ' -65 | 'closing bracket should be indented ' - | ^^^^ W191 -66 | "to match that of the opening " -67 | "bracket's line" +63 | return ( +64 | start, 'E121 lines starting with a ' +65 | 'closing bracket should be indented ' + | ^^^^^^^^ W191 +66 | "to match that of the opening " +67 | "bracket's line" | W19.py:64:1: W191 Indentation contains tabs | -64 | start, 'E121 lines starting with a ' -65 | 'closing bracket should be indented ' -66 | "to match that of the opening " - | ^^^^ W191 -67 | "bracket's line" -68 | ) +64 | start, 'E121 lines starting with a ' +65 | 'closing bracket should be indented ' +66 | "to match that of the opening " + | ^^^^^^^^ W191 +67 | "bracket's line" +68 | ) | W19.py:65:1: W191 Indentation contains tabs | -65 | 'closing bracket should be indented ' -66 | "to match that of the opening " -67 | "bracket's line" - | ^^^^ W191 -68 | ) +65 | 'closing bracket should be indented ' +66 | "to match that of the opening " +67 | "bracket's line" + | ^^^^^^^^ W191 +68 | ) 69 | # | W19.py:66:1: W191 Indentation contains tabs | -66 | "to match that of the opening " -67 | "bracket's line" -68 | ) - | W191 +66 | "to match that of the opening " +67 | "bracket's line" +68 | ) + | ^^^^ W191 69 | # 70 | #: E101 W191 W504 | @@ -171,8 +171,8 @@ W19.py:73:1: W191 Indentation contains tabs | 73 | foo.bar("bop") 74 | )): -75 | print "yes" - | W191 +75 | print "yes" + | ^^^^ W191 76 | #: E101 W191 W504 77 | # also ok, but starting to look like LISP | @@ -181,8 +181,8 @@ W19.py:78:1: W191 Indentation contains tabs | 78 | if ((foo.bar("baz") and 79 | foo.bar("bop"))): -80 | print "yes" - | W191 +80 | print "yes" + | ^^^^ W191 81 | #: E101 W191 W504 82 | if (a == 2 or | @@ -191,8 +191,8 @@ W19.py:83:1: W191 Indentation contains tabs | 83 | b == "abc def ghi" 84 | "jkl mno"): -85 | return True - | W191 +85 | return True + | ^^^^ W191 86 | #: E101 W191 W504 87 | if (a == 2 or | @@ -201,8 +201,8 @@ W19.py:88:1: W191 Indentation contains tabs | 88 | b == """abc def ghi 89 | jkl mno"""): -90 | return True - | W191 +90 | return True + | ^^^^ W191 91 | #: W191:2:1 W191:3:1 E101:3:2 92 | if length > options.max_line_length: | @@ -211,35 +211,35 @@ W19.py:91:1: W191 Indentation contains tabs | 91 | #: W191:2:1 W191:3:1 E101:3:2 92 | if length > options.max_line_length: -93 | return options.max_line_length, \ - | W191 -94 | "E501 line too long (%d characters)" % length +93 | return options.max_line_length, \ + | ^^^^ W191 +94 | "E501 line too long (%d characters)" % length | W19.py:92:1: W191 Indentation contains tabs | 92 | if length > options.max_line_length: -93 | return options.max_line_length, \ -94 | "E501 line too long (%d characters)" % length - | ^^^^ W191 +93 | return options.max_line_length, \ +94 | "E501 line too long (%d characters)" % length + | ^^^^^^^^ W191 | W19.py:98:1: W191 Indentation contains tabs | 98 | #: E101 W191 W191 W504 99 | if os.path.exists(os.path.join(path, PEP8_BIN)): -100 | cmd = ([os.path.join(path, PEP8_BIN)] + - | W191 -101 | self._pep8_options(targetfile)) +100 | cmd = ([os.path.join(path, PEP8_BIN)] + + | ^^^^ W191 +101 | self._pep8_options(targetfile)) 102 | #: W191 - okay | W19.py:99:1: W191 Indentation contains tabs | 99 | if os.path.exists(os.path.join(path, PEP8_BIN)): -100 | cmd = ([os.path.join(path, PEP8_BIN)] + -101 | self._pep8_options(targetfile)) - | ^^^^^^^ W191 +100 | cmd = ([os.path.join(path, PEP8_BIN)] + +101 | self._pep8_options(targetfile)) + | ^^^^^^^^^^^ W191 102 | #: W191 - okay 103 | ''' | @@ -248,36 +248,36 @@ W19.py:125:1: W191 Indentation contains tabs | 125 | if foo is None and bar is "bop" and \ 126 | blah == 'yeah': -127 | blah = 'yeahnah' - | W191 +127 | blah = 'yeahnah' + | ^^^^ W191 | W19.py:131:1: W191 Indentation contains tabs | 131 | #: W191 W191 W191 132 | if True: -133 | foo( - | W191 -134 | 1, -135 | 2) +133 | foo( + | ^^^^ W191 +134 | 1, +135 | 2) | W19.py:132:1: W191 Indentation contains tabs | 132 | if True: -133 | foo( -134 | 1, - | W191 -135 | 2) +133 | foo( +134 | 1, + | ^^^^^^^^ W191 +135 | 2) 136 | #: W191 W191 W191 W191 W191 | W19.py:133:1: W191 Indentation contains tabs | -133 | foo( -134 | 1, -135 | 2) - | W191 +133 | foo( +134 | 1, +135 | 2) + | ^^^^^^^^ W191 136 | #: W191 W191 W191 W191 W191 137 | def test_keys(self): | @@ -286,48 +286,48 @@ W19.py:136:1: W191 Indentation contains tabs | 136 | #: W191 W191 W191 W191 W191 137 | def test_keys(self): -138 | """areas.json - All regions are accounted for.""" - | W191 -139 | expected = set([ -140 | u'Norrbotten', +138 | """areas.json - All regions are accounted for.""" + | ^^^^ W191 +139 | expected = set([ +140 | u'Norrbotten', | W19.py:137:1: W191 Indentation contains tabs | 137 | def test_keys(self): -138 | """areas.json - All regions are accounted for.""" -139 | expected = set([ - | W191 -140 | u'Norrbotten', -141 | u'V\xe4sterbotten', +138 | """areas.json - All regions are accounted for.""" +139 | expected = set([ + | ^^^^ W191 +140 | u'Norrbotten', +141 | u'V\xe4sterbotten', | W19.py:138:1: W191 Indentation contains tabs | -138 | """areas.json - All regions are accounted for.""" -139 | expected = set([ -140 | u'Norrbotten', - | W191 -141 | u'V\xe4sterbotten', -142 | ]) +138 | """areas.json - All regions are accounted for.""" +139 | expected = set([ +140 | u'Norrbotten', + | ^^^^^^^^ W191 +141 | u'V\xe4sterbotten', +142 | ]) | W19.py:139:1: W191 Indentation contains tabs | -139 | expected = set([ -140 | u'Norrbotten', -141 | u'V\xe4sterbotten', - | W191 -142 | ]) +139 | expected = set([ +140 | u'Norrbotten', +141 | u'V\xe4sterbotten', + | ^^^^^^^^ W191 +142 | ]) 143 | #: W191 | W19.py:140:1: W191 Indentation contains tabs | -140 | u'Norrbotten', -141 | u'V\xe4sterbotten', -142 | ]) - | W191 +140 | u'Norrbotten', +141 | u'V\xe4sterbotten', +142 | ]) + | ^^^^ W191 143 | #: W191 144 | x = [ | @@ -336,8 +336,8 @@ W19.py:143:1: W191 Indentation contains tabs | 143 | #: W191 144 | x = [ -145 | 'abc' - | W191 +145 | 'abc' + | ^^^^ W191 146 | ] 147 | #: W191 - okay |