Skip to content

Commit

Permalink
Short rule messages should not end with a period (#9345)
Browse files Browse the repository at this point in the history
## Summary

Remove the period from a couple short messages, for consistency with all
other short messages.

All other short rule messages lack such a period, except for long
messages made of multiple sentences.

## Test Plan

Tests modified accordingly.

Not sure if this would qualify as a breaking change because user-visible
messages are modified.
  • Loading branch information
DimitriPapadopoulos authored Jan 2, 2024
1 parent 6821b81 commit 0a00205
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl Violation for UnnecessaryComprehensionAnyAll {

#[derive_message_formats]
fn message(&self) -> String {
format!("Unnecessary list comprehension.")
format!("Unnecessary list comprehension")
}

fn fix_title(&self) -> Option<String> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs
---
C419.py:1:5: C419 [*] Unnecessary list comprehension.
C419.py:1:5: C419 [*] Unnecessary list comprehension
|
1 | any([x.id for x in bar])
| ^^^^^^^^^^^^^^^^^^^ C419
Expand All @@ -17,7 +17,7 @@ C419.py:1:5: C419 [*] Unnecessary list comprehension.
3 3 | any( # first comment
4 4 | [x.id for x in bar], # second comment

C419.py:2:5: C419 [*] Unnecessary list comprehension.
C419.py:2:5: C419 [*] Unnecessary list comprehension
|
1 | any([x.id for x in bar])
2 | all([x.id for x in bar])
Expand All @@ -35,7 +35,7 @@ C419.py:2:5: C419 [*] Unnecessary list comprehension.
4 4 | [x.id for x in bar], # second comment
5 5 | ) # third comment

C419.py:4:5: C419 [*] Unnecessary list comprehension.
C419.py:4:5: C419 [*] Unnecessary list comprehension
|
2 | all([x.id for x in bar])
3 | any( # first comment
Expand All @@ -56,7 +56,7 @@ C419.py:4:5: C419 [*] Unnecessary list comprehension.
6 6 | all( # first comment
7 7 | [x.id for x in bar], # second comment

C419.py:7:5: C419 [*] Unnecessary list comprehension.
C419.py:7:5: C419 [*] Unnecessary list comprehension
|
5 | ) # third comment
6 | all( # first comment
Expand All @@ -77,7 +77,7 @@ C419.py:7:5: C419 [*] Unnecessary list comprehension.
9 9 | any({x.id for x in bar})
10 10 |

C419.py:9:5: C419 [*] Unnecessary list comprehension.
C419.py:9:5: C419 [*] Unnecessary list comprehension
|
7 | [x.id for x in bar], # second comment
8 | ) # third comment
Expand All @@ -98,7 +98,7 @@ C419.py:9:5: C419 [*] Unnecessary list comprehension.
11 11 | # OK
12 12 | all(x.id for x in bar)

C419.py:24:5: C419 [*] Unnecessary list comprehension.
C419.py:24:5: C419 [*] Unnecessary list comprehension
|
22 | # Special comment handling
23 | any(
Expand Down Expand Up @@ -133,7 +133,7 @@ C419.py:24:5: C419 [*] Unnecessary list comprehension.
31 30 | )
32 31 |

C419.py:35:5: C419 [*] Unnecessary list comprehension.
C419.py:35:5: C419 [*] Unnecessary list comprehension
|
33 | # Weird case where the function call, opening bracket, and comment are all
34 | # on the same line.
Expand Down
4 changes: 2 additions & 2 deletions crates/ruff_linter/src/rules/ruff/rules/invalid_index_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ impl Violation for InvalidIndexType {
is_slice,
} = self;
if *is_slice {
format!("Slice in indexed access to type `{value_type}` uses type `{index_type}` instead of an integer.")
format!("Slice in indexed access to type `{value_type}` uses type `{index_type}` instead of an integer")
} else {
format!(
"Indexed access to type `{value_type}` uses type `{index_type}` instead of an integer or slice."
"Indexed access to type `{value_type}` uses type `{index_type}` instead of an integer or slice"
)
}
}
Expand Down
Loading

0 comments on commit 0a00205

Please sign in to comment.