Skip to content

Commit

Permalink
Add test cases for ERA100 noqa conflict with RUF100
Browse files Browse the repository at this point in the history
  • Loading branch information
zanieb committed Aug 23, 2023
1 parent 0688883 commit c9eb20f
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crates/ruff/resources/test/fixtures/eradicate/ERA001.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,9 @@ def foo(x, y, z):
class A():
pass
# b = c


dictionary = {
# "key1": 123, # noqa: ERA001
# "key2": 456,
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,25 @@ ERA001.py:21:5: ERA001 [*] Found commented-out code
19 19 | class A():
20 20 | pass
21 |- # b = c
22 21 |
23 22 |
24 23 | dictionary = {

ERA001.py:26:5: ERA001 [*] Found commented-out code
|
24 | dictionary = {
25 | # "key1": 123, # noqa: ERA001
26 | # "key2": 456,
| ^^^^^^^^^^^^^^ ERA001
27 | }
|
= help: Remove commented-out code

Possible fix
23 23 |
24 24 | dictionary = {
25 25 | # "key1": 123, # noqa: ERA001
26 |- # "key2": 456,
27 26 | }


15 changes: 15 additions & 0 deletions crates/ruff/src/rules/ruff/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,21 @@ mod tests {
Ok(())
}

#[test]
fn ruf100_5() -> Result<()> {
let diagnostics = test_path(
Path::new("ruff/RUF100_5.py"),
&settings::Settings {
..settings::Settings::for_rules(vec![
Rule::UnusedNOQA,
Rule::LineTooLong,
Rule::CommentedOutCode,
])
},
)?;
assert_messages!(diagnostics);
Ok(())
}
#[test]
fn flake8_noqa() -> Result<()> {
let diagnostics = test_path(
Expand Down

0 comments on commit c9eb20f

Please sign in to comment.