Compare commits
1 Commits
pythonplus
...
charlie/sp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5120b36b67 |
@@ -53,16 +53,24 @@ impl Overlong {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let mut chunks = line.split_whitespace();
|
let mut chunks = line.split_whitespace();
|
||||||
let (Some(_), Some(second_chunk)) = (chunks.next(), chunks.next()) else {
|
if let (Some(_), Some(second_chunk)) = (chunks.next(), chunks.next()) {
|
||||||
// Single word / no printable chars - no way to make the line shorter.
|
// Do not enforce the line length for lines that end with a URL, as long as the URL
|
||||||
return None;
|
// begins before the limit.
|
||||||
};
|
let last_chunk = chunks.last().unwrap_or(second_chunk);
|
||||||
|
if last_chunk.contains("://") {
|
||||||
|
if width.get() - last_chunk.width() <= limit.value() as usize {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// This is a single word. If's a URL, ignore it.
|
||||||
|
if line.contains("://") {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
// Do not enforce the line length for lines that end with a URL, as long as the URL
|
// This is a single word. If there are no split points, ignore it.
|
||||||
// begins before the limit.
|
indexer.comment_ranges()
|
||||||
let last_chunk = chunks.last().unwrap_or(second_chunk);
|
if !line.contains(['(', '[', ')', ']', '{', '}', ';']) {
|
||||||
if last_chunk.contains("://") {
|
|
||||||
if width.get() - last_chunk.width() <= limit.value() as usize {
|
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,6 +79,15 @@ E501_2.py:14:6: E501 Line too long (7 > 6)
|
|||||||
16 | [1, 2]
|
16 | [1, 2]
|
||||||
|
|
|
|
||||||
|
|
||||||
|
E501_2.py:15:6: E501 Line too long (7 > 6)
|
||||||
|
|
|
||||||
|
13 | [12]
|
||||||
|
14 | [12 ]
|
||||||
|
15 | [1,2]
|
||||||
|
| ^ E501
|
||||||
|
16 | [1, 2]
|
||||||
|
|
|
||||||
|
|
||||||
E501_2.py:16:6: E501 Line too long (8 > 6)
|
E501_2.py:16:6: E501 Line too long (8 > 6)
|
||||||
|
|
|
|
||||||
14 | [12 ]
|
14 | [12 ]
|
||||||
|
|||||||
@@ -89,6 +89,15 @@ E501_2.py:10:3: E501 Line too long (13 > 6)
|
|||||||
12 | if True: # noqa: E501
|
12 | if True: # noqa: E501
|
||||||
|
|
|
|
||||||
|
|
||||||
|
E501_2.py:13:4: E501 Line too long (8 > 6)
|
||||||
|
|
|
||||||
|
12 | if True: # noqa: E501
|
||||||
|
13 | [12]
|
||||||
|
| ^^ E501
|
||||||
|
14 | [12 ]
|
||||||
|
15 | [1,2]
|
||||||
|
|
|
||||||
|
|
||||||
E501_2.py:14:4: E501 Line too long (9 > 6)
|
E501_2.py:14:4: E501 Line too long (9 > 6)
|
||||||
|
|
|
|
||||||
12 | if True: # noqa: E501
|
12 | if True: # noqa: E501
|
||||||
@@ -99,6 +108,15 @@ E501_2.py:14:4: E501 Line too long (9 > 6)
|
|||||||
16 | [1, 2]
|
16 | [1, 2]
|
||||||
|
|
|
|
||||||
|
|
||||||
|
E501_2.py:15:4: E501 Line too long (9 > 6)
|
||||||
|
|
|
||||||
|
13 | [12]
|
||||||
|
14 | [12 ]
|
||||||
|
15 | [1,2]
|
||||||
|
| ^^^ E501
|
||||||
|
16 | [1, 2]
|
||||||
|
|
|
||||||
|
|
||||||
E501_2.py:16:4: E501 Line too long (10 > 6)
|
E501_2.py:16:4: E501 Line too long (10 > 6)
|
||||||
|
|
|
|
||||||
14 | [12 ]
|
14 | [12 ]
|
||||||
|
|||||||
@@ -89,6 +89,15 @@ E501_2.py:10:2: E501 Line too long (21 > 6)
|
|||||||
12 | if True: # noqa: E501
|
12 | if True: # noqa: E501
|
||||||
|
|
|
|
||||||
|
|
||||||
|
E501_2.py:13:2: E501 Line too long (12 > 6)
|
||||||
|
|
|
||||||
|
12 | if True: # noqa: E501
|
||||||
|
13 | [12]
|
||||||
|
| ^^^^ E501
|
||||||
|
14 | [12 ]
|
||||||
|
15 | [1,2]
|
||||||
|
|
|
||||||
|
|
||||||
E501_2.py:14:2: E501 Line too long (13 > 6)
|
E501_2.py:14:2: E501 Line too long (13 > 6)
|
||||||
|
|
|
|
||||||
12 | if True: # noqa: E501
|
12 | if True: # noqa: E501
|
||||||
@@ -99,6 +108,15 @@ E501_2.py:14:2: E501 Line too long (13 > 6)
|
|||||||
16 | [1, 2]
|
16 | [1, 2]
|
||||||
|
|
|
|
||||||
|
|
||||||
|
E501_2.py:15:2: E501 Line too long (13 > 6)
|
||||||
|
|
|
||||||
|
13 | [12]
|
||||||
|
14 | [12 ]
|
||||||
|
15 | [1,2]
|
||||||
|
| ^^^^^ E501
|
||||||
|
16 | [1, 2]
|
||||||
|
|
|
||||||
|
|
||||||
E501_2.py:16:2: E501 Line too long (14 > 6)
|
E501_2.py:16:2: E501 Line too long (14 > 6)
|
||||||
|
|
|
|
||||||
14 | [12 ]
|
14 | [12 ]
|
||||||
|
|||||||
Reference in New Issue
Block a user