mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-30 13:51:37 +00:00
Fix TODO directive out of bounds acccess (#13756)
This commit is contained in:
parent
04b636cba2
commit
72ac6cd5a5
4 changed files with 21 additions and 10 deletions
|
@ -6,3 +6,8 @@
|
||||||
# hack: hack
|
# hack: hack
|
||||||
# FIXME: fixme
|
# FIXME: fixme
|
||||||
# fixme: fixme
|
# fixme: fixme
|
||||||
|
|
||||||
|
# test # TODO: todo
|
||||||
|
|
||||||
|
|
||||||
|
# #d#
|
||||||
|
|
|
@ -316,7 +316,7 @@ impl<'a> TodoDirective<'a> {
|
||||||
// Shrink the subset to check for the next phrase starting with "#".
|
// Shrink the subset to check for the next phrase starting with "#".
|
||||||
if let Some(new_offset) = trimmed.find('#') {
|
if let Some(new_offset) = trimmed.find('#') {
|
||||||
relative_offset += TextSize::try_from(new_offset).unwrap();
|
relative_offset += TextSize::try_from(new_offset).unwrap();
|
||||||
subset = &subset[relative_offset.to_usize()..];
|
subset = &comment[relative_offset.to_usize()..];
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
|
|
@ -16,6 +16,6 @@ T00.py:8:3: FIX001 Line contains FIXME, consider resolving the issue
|
||||||
7 | # FIXME: fixme
|
7 | # FIXME: fixme
|
||||||
8 | # fixme: fixme
|
8 | # fixme: fixme
|
||||||
| ^^^^^ FIX001
|
| ^^^^^ FIX001
|
||||||
|
9 |
|
||||||
|
10 | # test # TODO: todo
|
||||||
|
|
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,4 +18,10 @@ T00.py:2:3: FIX002 Line contains TODO, consider resolving the issue
|
||||||
4 | # xxx: xxx
|
4 | # xxx: xxx
|
||||||
|
|
|
|
||||||
|
|
||||||
|
T00.py:10:10: FIX002 Line contains TODO, consider resolving the issue
|
||||||
|
|
|
||||||
|
8 | # fixme: fixme
|
||||||
|
9 |
|
||||||
|
10 | # test # TODO: todo
|
||||||
|
| ^^^^ FIX002
|
||||||
|
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue