Extend TODO rule to exclude comments with explicit item links indicating follow-ups

Description: Improving the TODO rules for C#.
Why is there an issue: Presently, TODOs are getting flagged even if they have a tracking number, which might be intentional. I think the original point was to ensure devs aren’t forgetting the TODOs for the PRs; but a legitimate use case might be TODO: 654321 as a follow-up

Example non compliant code:
TODO: 687 - Update the gating NuGet and match with here (a sample title)

This would be flagged due to the TODO.

Type: Code Smell.

Hey @Arman_Hilmioglu, welcome to our community and great to see you :smiley:.

I would say that it’s a code smell to have in general TODOs in the code. There’s no way to verify, for example, that the ticket is still open, or that it exists in the first place.

And I’d say that it could be an advantage to see how many TODOs are around in the code (tracked or not tracked). Or not. It’s subjective and depends on the team processes.

Indeed, a TODO without an assigned (open) ticket should be caught during review.

1 Like

We’ve had an internal discussion and our general idea is that the TODO is a code smell.

However, inside Visual Studio you can configure the keywords to show up in TaskList (Tools → Options → environmenttask list → tokens).

If you need, you can define something else like "Ticket: " in VS configuration.