mirror of https://github.com/astral-sh/ruff
Allow multiline shebangs and code separators in E265
This commit is contained in:
parent
8a529925b3
commit
930d8062d1
|
|
@ -72,3 +72,8 @@ a = 42 # (Two spaces)
|
|||
# EF Means test is giving error and Failing
|
||||
#! Means test is segfaulting
|
||||
# 8 Means test runs forever
|
||||
|
||||
#%%
|
||||
# %%
|
||||
# This is a comment
|
||||
# This is another comment
|
||||
|
|
|
|||
|
|
@ -167,10 +167,10 @@ pub(crate) fn whitespace_before_comment(
|
|||
let symbol = parts.next().unwrap_or("");
|
||||
let comment = parts.next().unwrap_or("");
|
||||
|
||||
let bad_prefix = if symbol != "#" && symbol != "#:" {
|
||||
Some(symbol.trim_start_matches('#').chars().next().unwrap_or('#'))
|
||||
} else {
|
||||
let bad_prefix = if matches!(symbol, "#" | "#:" | "#!" | "#%%") {
|
||||
None
|
||||
} else {
|
||||
Some(symbol.trim_start_matches('#').chars().next().unwrap_or('#'))
|
||||
};
|
||||
|
||||
if is_inline_comment {
|
||||
|
|
|
|||
|
|
@ -11,16 +11,6 @@ E26.py:10:1: E265 Block comment should start with `# `
|
|||
12 | #: E265:2:1
|
||||
|
|
||||
|
||||
E26.py:14:1: E265 Block comment should start with `# `
|
||||
|
|
||||
12 | #: E265:2:1
|
||||
13 | m = 42
|
||||
14 | #! This is important
|
||||
| ^^^^^^^^^^^^^^^^^^^^ E265
|
||||
15 | mx = 42 - 42
|
||||
16 | #: E266:3:5 E266:6:5
|
||||
|
|
||||
|
||||
E26.py:25:1: E265 Block comment should start with `# `
|
||||
|
|
||||
23 | return
|
||||
|
|
@ -40,13 +30,4 @@ E26.py:32:1: E265 Block comment should start with `# `
|
|||
34 | pass # an inline comment
|
||||
|
|
||||
|
||||
E26.py:73:1: E265 Block comment should start with `# `
|
||||
|
|
||||
71 | # F Means test is failing (F)
|
||||
72 | # EF Means test is giving error and Failing
|
||||
73 | #! Means test is segfaulting
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E265
|
||||
74 | # 8 Means test runs forever
|
||||
|
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,4 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
|
||||
---
|
||||
shebang.py:3:1: E265 Block comment should start with `# `
|
||||
|
|
||||
1 | #!/usr/bin/python
|
||||
2 | #
|
||||
3 | #!
|
||||
| ^^ E265
|
||||
4 | #:
|
||||
|
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue