Skip to content

Commit 2587aef

Browse files
authored
Add formatter to line-length documentation (#8150)
1 parent 7f4ea66 commit 2587aef

15 files changed

+92
-80
lines changed

crates/ruff_linter/src/rules/pycodestyle/rules/doc_line_too_long.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ impl Violation for DocLineTooLong {
6464
#[derive_message_formats]
6565
fn message(&self) -> String {
6666
let DocLineTooLong(width, limit) = self;
67-
format!("Doc line too long ({width} > {limit} characters)")
67+
format!("Doc line too long ({width} > {limit})")
6868
}
6969
}
7070

crates/ruff_linter/src/rules/pycodestyle/rules/line_too_long.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl Violation for LineTooLong {
5858
#[derive_message_formats]
5959
fn message(&self) -> String {
6060
let LineTooLong(width, limit) = self;
61-
format!("Line too long ({width} > {limit} characters)")
61+
format!("Line too long ({width} > {limit})")
6262
}
6363
}
6464

crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E501_E501.py.snap

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
33
---
4-
E501.py:5:89: E501 Line too long (123 > 88 characters)
4+
E501.py:5:89: E501 Line too long (123 > 88)
55
|
66
3 | https://github.com/PyCQA/pycodestyle/pull/258/files#diff-841c622497a8033d10152bfdfb15b20b92437ecdea21a260944ea86b77b51533
77
4 |
@@ -10,14 +10,14 @@ E501.py:5:89: E501 Line too long (123 > 88 characters)
1010
6 | """
1111
|
1212

13-
E501.py:16:85: E501 Line too long (95 > 88 characters)
13+
E501.py:16:85: E501 Line too long (95 > 88)
1414
|
1515
15 | _ = "---------------------------------------------------------------------------AAAAAAA"
1616
16 | _ = "---------------------------------------------------------------------------亜亜亜亜亜亜亜"
1717
| ^^^^^^^ E501
1818
|
1919

20-
E501.py:25:89: E501 Line too long (127 > 88 characters)
20+
E501.py:25:89: E501 Line too long (127 > 88)
2121
|
2222
23 | caller(
2323
24 | """
@@ -27,7 +27,7 @@ E501.py:25:89: E501 Line too long (127 > 88 characters)
2727
27 | )
2828
|
2929

30-
E501.py:40:89: E501 Line too long (132 > 88 characters)
30+
E501.py:40:89: E501 Line too long (132 > 88)
3131
|
3232
38 | "Lorem ipsum dolor": "sit amet",
3333
39 | # E501 Line too long
@@ -37,7 +37,7 @@ E501.py:40:89: E501 Line too long (132 > 88 characters)
3737
42 | "Lorem ipsum dolor": """
3838
|
3939

40-
E501.py:43:89: E501 Line too long (105 > 88 characters)
40+
E501.py:43:89: E501 Line too long (105 > 88)
4141
|
4242
41 | # E501 Line too long
4343
42 | "Lorem ipsum dolor": """
@@ -47,7 +47,7 @@ E501.py:43:89: E501 Line too long (105 > 88 characters)
4747
45 | # OK
4848
|
4949

50-
E501.py:83:89: E501 Line too long (147 > 88 characters)
50+
E501.py:83:89: E501 Line too long (147 > 88)
5151
|
5252
81 | class Bar:
5353
82 | """

crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E501_E501_3.py.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
33
---
4-
E501_3.py:11:89: E501 Line too long (89 > 88 characters)
4+
E501_3.py:11:89: E501 Line too long (89 > 88)
55
|
66
10 | # Error (89 characters)
77
11 | "shape:" + "shape:" + "shape:" + "shape:" + "shape:" + "shape:" + "shape:" + "shape:aaaa" # type: ignore

crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__max_doc_length.snap

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
33
---
4-
W505.py:2:51: W505 Doc line too long (57 > 50 characters)
4+
W505.py:2:51: W505 Doc line too long (57 > 50)
55
|
66
1 | #!/usr/bin/env python3
77
2 | """Here's a top-level docstring that's over the limit."""
88
| ^^^^^^^ W505
99
|
1010

11-
W505.py:6:51: W505 Doc line too long (56 > 50 characters)
11+
W505.py:6:51: W505 Doc line too long (56 > 50)
1212
|
1313
5 | def f1():
1414
6 | """Here's a docstring that's also over the limit."""
@@ -17,7 +17,7 @@ W505.py:6:51: W505 Doc line too long (56 > 50 characters)
1717
8 | x = 1 # Here's a comment that's over the limit, but it's not standalone.
1818
|
1919

20-
W505.py:10:51: W505 Doc line too long (56 > 50 characters)
20+
W505.py:10:51: W505 Doc line too long (56 > 50)
2121
|
2222
8 | x = 1 # Here's a comment that's over the limit, but it's not standalone.
2323
9 |
@@ -27,7 +27,7 @@ W505.py:10:51: W505 Doc line too long (56 > 50 characters)
2727
12 | x = 2
2828
|
2929

30-
W505.py:13:51: W505 Doc line too long (93 > 50 characters)
30+
W505.py:13:51: W505 Doc line too long (93 > 50)
3131
|
3232
12 | x = 2
3333
13 | # Another standalone that is preceded by a newline and indent toke and is over the limit.
@@ -36,13 +36,13 @@ W505.py:13:51: W505 Doc line too long (93 > 50 characters)
3636
15 | print("Here's a string that's over the limit, but it's not a docstring.")
3737
|
3838

39-
W505.py:18:51: W505 Doc line too long (61 > 50 characters)
39+
W505.py:18:51: W505 Doc line too long (61 > 50)
4040
|
4141
18 | "This is also considered a docstring, and is over the limit."
4242
| ^^^^^^^^^^^ W505
4343
|
4444

45-
W505.py:24:51: W505 Doc line too long (82 > 50 characters)
45+
W505.py:24:51: W505 Doc line too long (82 > 50)
4646
|
4747
22 | """Here's a multi-line docstring.
4848
23 |
@@ -51,7 +51,7 @@ W505.py:24:51: W505 Doc line too long (82 > 50 characters)
5151
25 | """
5252
|
5353

54-
W505.py:31:51: W505 Doc line too long (85 > 50 characters)
54+
W505.py:31:51: W505 Doc line too long (85 > 50)
5555
|
5656
29 | """Here's a multi-line docstring.
5757
30 |

crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__max_doc_length_with_utf_8.snap

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
33
---
4-
W505_utf_8.py:2:50: W505 Doc line too long (57 > 50 characters)
4+
W505_utf_8.py:2:50: W505 Doc line too long (57 > 50)
55
|
66
1 | #!/usr/bin/env python3
77
2 | """Here's a top-level ß9💣2ℝing that's over theß9💣2ℝ."""
88
| ^^^^^^ W505
99
|
1010

11-
W505_utf_8.py:6:49: W505 Doc line too long (56 > 50 characters)
11+
W505_utf_8.py:6:49: W505 Doc line too long (56 > 50)
1212
|
1313
5 | def f1():
1414
6 | """Here's a ß9💣2ℝing that's also over theß9💣2ℝ."""
@@ -17,7 +17,7 @@ W505_utf_8.py:6:49: W505 Doc line too long (56 > 50 characters)
1717
8 | x = 1 # Here's a comment that's over theß9💣2ℝ, but it's not standalone.
1818
|
1919

20-
W505_utf_8.py:10:51: W505 Doc line too long (56 > 50 characters)
20+
W505_utf_8.py:10:51: W505 Doc line too long (56 > 50)
2121
|
2222
8 | x = 1 # Here's a comment that's over theß9💣2ℝ, but it's not standalone.
2323
9 |
@@ -27,7 +27,7 @@ W505_utf_8.py:10:51: W505 Doc line too long (56 > 50 characters)
2727
12 | x = 2
2828
|
2929

30-
W505_utf_8.py:13:51: W505 Doc line too long (93 > 50 characters)
30+
W505_utf_8.py:13:51: W505 Doc line too long (93 > 50)
3131
|
3232
12 | x = 2
3333
13 | # Another standalone that is preceded by a newline and indent toke and is over theß9💣2ℝ.
@@ -36,13 +36,13 @@ W505_utf_8.py:13:51: W505 Doc line too long (93 > 50 characters)
3636
15 | print("Here's a string that's over theß9💣2ℝ, but it's not a ß9💣2ℝing.")
3737
|
3838

39-
W505_utf_8.py:18:50: W505 Doc line too long (61 > 50 characters)
39+
W505_utf_8.py:18:50: W505 Doc line too long (61 > 50)
4040
|
4141
18 | "This is also considered a ß9💣2ℝing, and is over theß9💣2ℝ."
4242
| ^^^^^^^^^^^ W505
4343
|
4444

45-
W505_utf_8.py:24:50: W505 Doc line too long (82 > 50 characters)
45+
W505_utf_8.py:24:50: W505 Doc line too long (82 > 50)
4646
|
4747
22 | """Here's a multi-line ß9💣2ℝing.
4848
23 |
@@ -51,7 +51,7 @@ W505_utf_8.py:24:50: W505 Doc line too long (82 > 50 characters)
5151
25 | """
5252
|
5353

54-
W505_utf_8.py:31:50: W505 Doc line too long (85 > 50 characters)
54+
W505_utf_8.py:31:50: W505 Doc line too long (85 > 50)
5555
|
5656
29 | """Here's a multi-line ß9💣2ℝing.
5757
30 |

crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__tab_size_1.snap

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
33
---
4-
E501_2.py:2:7: E501 Line too long (7 > 6 characters)
4+
E501_2.py:2:7: E501 Line too long (7 > 6)
55
|
66
1 | # aaaa
77
2 | # aaaaa
@@ -10,7 +10,7 @@ E501_2.py:2:7: E501 Line too long (7 > 6 characters)
1010
4 | # a
1111
|
1212

13-
E501_2.py:3:7: E501 Line too long (7 > 6 characters)
13+
E501_2.py:3:7: E501 Line too long (7 > 6)
1414
|
1515
1 | # aaaa
1616
2 | # aaaaa
@@ -20,7 +20,7 @@ E501_2.py:3:7: E501 Line too long (7 > 6 characters)
2020
5 | # aa
2121
|
2222

23-
E501_2.py:7:7: E501 Line too long (7 > 6 characters)
23+
E501_2.py:7:7: E501 Line too long (7 > 6)
2424
|
2525
5 | # aa
2626
6 | # aaa
@@ -30,7 +30,7 @@ E501_2.py:7:7: E501 Line too long (7 > 6 characters)
3030
9 | # aa
3131
|
3232

33-
E501_2.py:10:7: E501 Line too long (7 > 6 characters)
33+
E501_2.py:10:7: E501 Line too long (7 > 6)
3434
|
3535
8 | # a
3636
9 | # aa
@@ -40,7 +40,7 @@ E501_2.py:10:7: E501 Line too long (7 > 6 characters)
4040
12 | if True: # noqa: E501
4141
|
4242

43-
E501_2.py:16:7: E501 Line too long (7 > 6 characters)
43+
E501_2.py:16:7: E501 Line too long (7 > 6)
4444
|
4545
14 | [12 ]
4646
15 | [1,2]

crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__tab_size_2.snap

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
33
---
4-
E501_2.py:2:7: E501 Line too long (7 > 6 characters)
4+
E501_2.py:2:7: E501 Line too long (7 > 6)
55
|
66
1 | # aaaa
77
2 | # aaaaa
@@ -10,7 +10,7 @@ E501_2.py:2:7: E501 Line too long (7 > 6 characters)
1010
4 | # a
1111
|
1212

13-
E501_2.py:3:7: E501 Line too long (7 > 6 characters)
13+
E501_2.py:3:7: E501 Line too long (7 > 6)
1414
|
1515
1 | # aaaa
1616
2 | # aaaaa
@@ -20,7 +20,7 @@ E501_2.py:3:7: E501 Line too long (7 > 6 characters)
2020
5 | # aa
2121
|
2222

23-
E501_2.py:6:6: E501 Line too long (7 > 6 characters)
23+
E501_2.py:6:6: E501 Line too long (7 > 6)
2424
|
2525
4 | # a
2626
5 | # aa
@@ -30,7 +30,7 @@ E501_2.py:6:6: E501 Line too long (7 > 6 characters)
3030
8 | # a
3131
|
3232

33-
E501_2.py:7:6: E501 Line too long (8 > 6 characters)
33+
E501_2.py:7:6: E501 Line too long (8 > 6)
3434
|
3535
5 | # aa
3636
6 | # aaa
@@ -40,7 +40,7 @@ E501_2.py:7:6: E501 Line too long (8 > 6 characters)
4040
9 | # aa
4141
|
4242

43-
E501_2.py:8:5: E501 Line too long (7 > 6 characters)
43+
E501_2.py:8:5: E501 Line too long (7 > 6)
4444
|
4545
6 | # aaa
4646
7 | # aaaa
@@ -50,7 +50,7 @@ E501_2.py:8:5: E501 Line too long (7 > 6 characters)
5050
10 | # aaa
5151
|
5252

53-
E501_2.py:9:5: E501 Line too long (8 > 6 characters)
53+
E501_2.py:9:5: E501 Line too long (8 > 6)
5454
|
5555
7 | # aaaa
5656
8 | # a
@@ -59,7 +59,7 @@ E501_2.py:9:5: E501 Line too long (8 > 6 characters)
5959
10 | # aaa
6060
|
6161

62-
E501_2.py:10:5: E501 Line too long (9 > 6 characters)
62+
E501_2.py:10:5: E501 Line too long (9 > 6)
6363
|
6464
8 | # a
6565
9 | # aa
@@ -69,7 +69,7 @@ E501_2.py:10:5: E501 Line too long (9 > 6 characters)
6969
12 | if True: # noqa: E501
7070
|
7171

72-
E501_2.py:14:6: E501 Line too long (7 > 6 characters)
72+
E501_2.py:14:6: E501 Line too long (7 > 6)
7373
|
7474
12 | if True: # noqa: E501
7575
13 | [12]
@@ -79,7 +79,7 @@ E501_2.py:14:6: E501 Line too long (7 > 6 characters)
7979
16 | [1, 2]
8080
|
8181

82-
E501_2.py:16:6: E501 Line too long (8 > 6 characters)
82+
E501_2.py:16:6: E501 Line too long (8 > 6)
8383
|
8484
14 | [12 ]
8585
15 | [1,2]

0 commit comments

Comments
 (0)