Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve B015 message #8295

Merged
merged 3 commits into from
Oct 28, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl Violation for UselessComparison {
#[derive_message_formats]
fn message(&self) -> String {
format!(
"Pointless comparison. This comparison does nothing but waste CPU instructions. \
"Pointless comparison. This comparison does nothing. Did you mean to assign a value? \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'd suggest removing "This comparison does nothing.", it feels redundant.

Either prepend `assert` or remove it."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should now be Otherwise, prepend...

)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs
---
B015.py:3:1: B015 Pointless comparison. This comparison does nothing but waste CPU instructions. Either prepend `assert` or remove it.
B015.py:3:1: B015 Pointless comparison. This comparison does nothing. Did you mean to assign a value? Either prepend `assert` or remove it.
|
1 | assert 1 == 1
2 |
Expand All @@ -11,23 +11,23 @@ B015.py:3:1: B015 Pointless comparison. This comparison does nothing but waste C
5 | assert 1 in (1, 2)
|

B015.py:7:1: B015 Pointless comparison. This comparison does nothing but waste CPU instructions. Either prepend `assert` or remove it.
B015.py:7:1: B015 Pointless comparison. This comparison does nothing. Did you mean to assign a value? Either prepend `assert` or remove it.
|
5 | assert 1 in (1, 2)
6 |
7 | 1 in (1, 2)
| ^^^^^^^^^^^ B015
|

B015.py:17:5: B015 Pointless comparison. This comparison does nothing but waste CPU instructions. Either prepend `assert` or remove it.
B015.py:17:5: B015 Pointless comparison. This comparison does nothing. Did you mean to assign a value? Either prepend `assert` or remove it.
|
15 | assert 1 in (1, 2)
16 |
17 | 1 in (1, 2)
| ^^^^^^^^^^^ B015
|

B015.py:24:5: B015 Pointless comparison. This comparison does nothing but waste CPU instructions. Either prepend `assert` or remove it.
B015.py:24:5: B015 Pointless comparison. This comparison does nothing. Did you mean to assign a value? Either prepend `assert` or remove it.
|
23 | class TestClass:
24 | 1 == 1
Expand Down
Loading