Set non-empty range for indentation diagnostics (#4005)

This commit is contained in:
Micha Reiser 2023-04-18 16:26:13 +02:00 committed by GitHub
parent 6c3e4ef441
commit c0cf87356e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 22 additions and 22 deletions

View File

@ -183,7 +183,7 @@ pub fn check_logical_lines(
if settings.rules.enabled(kind.rule()) { if settings.rules.enabled(kind.rule()) {
diagnostics.push(Diagnostic { diagnostics.push(Diagnostic {
kind, kind,
location, location: Location::new(start_loc.row(), 0),
end_location: location, end_location: location,
fix: Fix::empty(), fix: Fix::empty(),
parent: None, parent: None,

View File

@ -1,22 +1,22 @@
--- ---
source: crates/ruff/src/rules/pycodestyle/mod.rs source: crates/ruff/src/rules/pycodestyle/mod.rs
--- ---
E11.py:3:3: E111 Indentation is not a multiple of 4 E11.py:3:1: E111 Indentation is not a multiple of 4
| |
3 | #: E111 3 | #: E111
4 | if x > 2: 4 | if x > 2:
5 | print(x) 5 | print(x)
| E111 | ^^ E111
6 | #: E111 E117 6 | #: E111 E117
7 | if True: 7 | if True:
| |
E11.py:6:6: E111 Indentation is not a multiple of 4 E11.py:6:1: E111 Indentation is not a multiple of 4
| |
6 | #: E111 E117 6 | #: E111 E117
7 | if True: 7 | if True:
8 | print() 8 | print()
| E111 | ^^^^^ E111
9 | #: E112 9 | #: E112
10 | if False: 10 | if False:
| |

View File

@ -1,12 +1,12 @@
--- ---
source: crates/ruff/src/rules/pycodestyle/mod.rs source: crates/ruff/src/rules/pycodestyle/mod.rs
--- ---
E11.py:12:5: E113 Unexpected indentation E11.py:12:1: E113 Unexpected indentation
| |
12 | #: E113 12 | #: E113
13 | print() 13 | print()
14 | print() 14 | print()
| E113 | ^^^^ E113
15 | #: E114 E116 15 | #: E114 E116
16 | mimetype = 'application/x-directory' 16 | mimetype = 'application/x-directory'
| |

View File

@ -1,12 +1,12 @@
--- ---
source: crates/ruff/src/rules/pycodestyle/mod.rs source: crates/ruff/src/rules/pycodestyle/mod.rs
--- ---
E11.py:15:6: E114 Indentation is not a multiple of 4 (comment) E11.py:15:1: E114 Indentation is not a multiple of 4 (comment)
| |
15 | #: E114 E116 15 | #: E114 E116
16 | mimetype = 'application/x-directory' 16 | mimetype = 'application/x-directory'
17 | # 'httpd/unix-directory' 17 | # 'httpd/unix-directory'
| E114 | ^^^^^ E114
18 | create_date = False 18 | create_date = False
19 | #: E116 E116 E116 19 | #: E116 E116 E116
| |

View File

@ -1,42 +1,42 @@
--- ---
source: crates/ruff/src/rules/pycodestyle/mod.rs source: crates/ruff/src/rules/pycodestyle/mod.rs
--- ---
E11.py:15:6: E116 Unexpected indentation (comment) E11.py:15:1: E116 Unexpected indentation (comment)
| |
15 | #: E114 E116 15 | #: E114 E116
16 | mimetype = 'application/x-directory' 16 | mimetype = 'application/x-directory'
17 | # 'httpd/unix-directory' 17 | # 'httpd/unix-directory'
| E116 | ^^^^^ E116
18 | create_date = False 18 | create_date = False
19 | #: E116 E116 E116 19 | #: E116 E116 E116
| |
E11.py:22:13: E116 Unexpected indentation (comment) E11.py:22:1: E116 Unexpected indentation (comment)
| |
22 | self.master.start() 22 | self.master.start()
23 | # try: 23 | # try:
24 | # self.master.start() 24 | # self.master.start()
| E116 | ^^^^^^^^^^^^ E116
25 | # except MasterExit: 25 | # except MasterExit:
26 | # self.shutdown() 26 | # self.shutdown()
| |
E11.py:24:13: E116 Unexpected indentation (comment) E11.py:24:1: E116 Unexpected indentation (comment)
| |
24 | # self.master.start() 24 | # self.master.start()
25 | # except MasterExit: 25 | # except MasterExit:
26 | # self.shutdown() 26 | # self.shutdown()
| E116 | ^^^^^^^^^^^^ E116
27 | # finally: 27 | # finally:
28 | # sys.exit() 28 | # sys.exit()
| |
E11.py:26:13: E116 Unexpected indentation (comment) E11.py:26:1: E116 Unexpected indentation (comment)
| |
26 | # self.shutdown() 26 | # self.shutdown()
27 | # finally: 27 | # finally:
28 | # sys.exit() 28 | # sys.exit()
| E116 | ^^^^^^^^^^^^ E116
29 | #: E115 E115 E115 E115 E115 E115 29 | #: E115 E115 E115 E115 E115 E115
30 | def start(self): 30 | def start(self):
| |

View File

@ -1,27 +1,27 @@
--- ---
source: crates/ruff/src/rules/pycodestyle/mod.rs source: crates/ruff/src/rules/pycodestyle/mod.rs
--- ---
E11.py:6:6: E117 Over-indented E11.py:6:1: E117 Over-indented
| |
6 | #: E111 E117 6 | #: E111 E117
7 | if True: 7 | if True:
8 | print() 8 | print()
| E117 | ^^^^^ E117
9 | #: E112 9 | #: E112
10 | if False: 10 | if False:
| |
E11.py:39:9: E117 Over-indented E11.py:39:1: E117 Over-indented
| |
39 | #: E117 39 | #: E117
40 | def start(): 40 | def start():
41 | print() 41 | print()
| E117 | ^^^^^^^^ E117
42 | #: E117 W191 42 | #: E117 W191
43 | def start(): 43 | def start():
| |
E11.py:42:3: E117 Over-indented E11.py:42:1: E117 Over-indented
| |
42 | #: E117 W191 42 | #: E117 W191
43 | def start(): 43 | def start():