diff --git a/crates/ruff/resources/test/fixtures/eradicate/ERA001.py b/crates/ruff/resources/test/fixtures/eradicate/ERA001.py index a21d51c4ca94da..f78d5af182123e 100644 --- a/crates/ruff/resources/test/fixtures/eradicate/ERA001.py +++ b/crates/ruff/resources/test/fixtures/eradicate/ERA001.py @@ -19,3 +19,9 @@ def foo(x, y, z): class A(): pass # b = c + + +dictionary = { + # "key1": 123, # noqa: ERA001 + # "key2": 456, +} diff --git a/crates/ruff/src/rules/eradicate/snapshots/ruff__rules__eradicate__tests__ERA001_ERA001.py.snap b/crates/ruff/src/rules/eradicate/snapshots/ruff__rules__eradicate__tests__ERA001_ERA001.py.snap index 17ccde3ca7e5ea..d768661abaa360 100644 --- a/crates/ruff/src/rules/eradicate/snapshots/ruff__rules__eradicate__tests__ERA001_ERA001.py.snap +++ b/crates/ruff/src/rules/eradicate/snapshots/ruff__rules__eradicate__tests__ERA001_ERA001.py.snap @@ -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 | } diff --git a/crates/ruff/src/rules/ruff/mod.rs b/crates/ruff/src/rules/ruff/mod.rs index be54ab37f2f7cc..79028c9b5b2357 100644 --- a/crates/ruff/src/rules/ruff/mod.rs +++ b/crates/ruff/src/rules/ruff/mod.rs @@ -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(