linter icon indicating copy to clipboard operation
linter copied to clipboard

[flutter_style_todos] Only allow blank characters before `TODO`

Open AlexV525 opened this issue 3 years ago • 3 comments

Description

The flutter_style_todos rule is used to allow any single character before TODO, this PR disallows it.

Fixes #3919

AlexV525 avatar Dec 21 '22 09:12 AlexV525

Coverage Status

Coverage remained the same at 95.636% when pulling d1beef52254a5eee77f0ced602544aac6b8c7f1e on AlexV525:improve-flutter-style-todos into 104a1977728b8d6e98da5360ba09312018f5a542 on dart-lang:main.

coveralls avatar Dec 21 '22 09:12 coveralls

/fyi @a14n @goderbauer

pq avatar Dec 22 '22 19:12 pq

The description here was confusing to me. It's technically correct in that this PR changes (restricts) the definition of what is considered a TODO, and therefore what can trigger being an invalid TODO.

Maybe it's the word "disallows" that throws me off, because the change allows (removes a lint warning from) a line like:

  // Not a TODO.

Is the following description a correct interpretation of the change?

Changes what counts as a TODO to include fewer occurrences of "todo".

Previously anything of the form //<anything> TODO (any casing) would count as a TODO, and could then be considered a malformed TODO by the lint. With the change, only two or more /s, followed by zero or one whitespace, and the "TODO" letters will be considered as a TODO, and other occurrences of "//" followed by "TODO" will not trigger the lint. That allows code like /// if (test) log(Severity.low, ToDo("Warning")); (fx as part of a DartDoc code sample) to not be linted against.

lrhn avatar Feb 12 '24 14:02 lrhn

Maybe it's the word "disallows" that throws me off, because the change allows (removes a lint warning from) a line like:

@lrhn The request was long ago. If I understand correctly I'm trying to say that pattern will not be recognized as TODOs. Does that sound good to you?

AlexV525 avatar Apr 14 '24 04:04 AlexV525

Ack, I accidentally fell over this CL and didn't notice how old the request was. But yes, the charge is to not recognize some lines as being intended as todos, which were previously considered (possibly invalid) todos. It restricts the lines that are considered todos.

lrhn avatar Apr 14 '24 06:04 lrhn

I'd probably reboot this in recent weeks. The reason why I didn't work on it anymore is I didn't receive responses.

AlexV525 avatar Apr 14 '24 07:04 AlexV525