diff --git a/crates/ruff_linter/resources/test/fixtures/flake8_fixme/T00.py b/crates/ruff_linter/resources/test/fixtures/flake8_fixme/T00.py index a398610c1c..77bde03d70 100644 --- a/crates/ruff_linter/resources/test/fixtures/flake8_fixme/T00.py +++ b/crates/ruff_linter/resources/test/fixtures/flake8_fixme/T00.py @@ -6,3 +6,8 @@ # hack: hack # FIXME: fixme # fixme: fixme + +# test # TODO: todo + + +# #d# diff --git a/crates/ruff_linter/src/directives.rs b/crates/ruff_linter/src/directives.rs index 43c28df171..50d23c40bc 100644 --- a/crates/ruff_linter/src/directives.rs +++ b/crates/ruff_linter/src/directives.rs @@ -316,7 +316,7 @@ impl<'a> TodoDirective<'a> { // Shrink the subset to check for the next phrase starting with "#". if let Some(new_offset) = trimmed.find('#') { relative_offset += TextSize::try_from(new_offset).unwrap(); - subset = &subset[relative_offset.to_usize()..]; + subset = &comment[relative_offset.to_usize()..]; } else { break; }; diff --git a/crates/ruff_linter/src/rules/flake8_fixme/snapshots/ruff_linter__rules__flake8_fixme__tests__line-contains-fixme_T00.py.snap b/crates/ruff_linter/src/rules/flake8_fixme/snapshots/ruff_linter__rules__flake8_fixme__tests__line-contains-fixme_T00.py.snap index c704c93411..3d83ddf257 100644 --- a/crates/ruff_linter/src/rules/flake8_fixme/snapshots/ruff_linter__rules__flake8_fixme__tests__line-contains-fixme_T00.py.snap +++ b/crates/ruff_linter/src/rules/flake8_fixme/snapshots/ruff_linter__rules__flake8_fixme__tests__line-contains-fixme_T00.py.snap @@ -11,11 +11,11 @@ T00.py:7:3: FIX001 Line contains FIXME, consider resolving the issue | T00.py:8:3: FIX001 Line contains FIXME, consider resolving the issue - | -6 | # hack: hack -7 | # FIXME: fixme -8 | # fixme: fixme - | ^^^^^ FIX001 - | - - + | + 6 | # hack: hack + 7 | # FIXME: fixme + 8 | # fixme: fixme + | ^^^^^ FIX001 + 9 | +10 | # test # TODO: todo + | diff --git a/crates/ruff_linter/src/rules/flake8_fixme/snapshots/ruff_linter__rules__flake8_fixme__tests__line-contains-todo_T00.py.snap b/crates/ruff_linter/src/rules/flake8_fixme/snapshots/ruff_linter__rules__flake8_fixme__tests__line-contains-todo_T00.py.snap index 4917963f2a..bd9fcc070d 100644 --- a/crates/ruff_linter/src/rules/flake8_fixme/snapshots/ruff_linter__rules__flake8_fixme__tests__line-contains-todo_T00.py.snap +++ b/crates/ruff_linter/src/rules/flake8_fixme/snapshots/ruff_linter__rules__flake8_fixme__tests__line-contains-todo_T00.py.snap @@ -18,4 +18,10 @@ T00.py:2:3: FIX002 Line contains TODO, consider resolving the issue 4 | # xxx: xxx | - +T00.py:10:10: FIX002 Line contains TODO, consider resolving the issue + | + 8 | # fixme: fixme + 9 | +10 | # test # TODO: todo + | ^^^^ FIX002 + |