Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce actionable and trackable TODO comments #215

Open
bartekpacia opened this issue Nov 20, 2023 · 4 comments
Open

Enforce actionable and trackable TODO comments #215

bartekpacia opened this issue Nov 20, 2023 · 4 comments
Labels
enhancement New feature or request p: leancode_lint Related to the leancode_lint package

Comments

@bartekpacia
Copy link
Contributor

bartekpacia commented Nov 20, 2023

In Patrol, I have accumulated many TODO comments, and I'm not happy with their quality. I would like to be able enforce "good TODOs" - TODOs that have a link to a GitHub issue so the team doesn't lose track of them.

Examples

BAD

// TODO: set reasonable duration or create new exception for this case
// TODO(bartekpacia): set reasonable duration or create new exception for this case
// TODO(bartekpacia): set reasonable duration or create new exception for this case. See #2137

The last is wrong because it makes no sense to include username in the TODO since the person responsible for the issue will very likely be the author of the issue.

GOOD

// TODO: set reasonable duration or create new exception for this case. See https://github.com/leancodepl/patrol/issues/2137

or we could go full-minimalism style - just require the issue number:

// TODO: set reasonable duration or create new exception for this case. See #2137

To paraphrase:

  • GOAL: Enforce every TODO comment to have See #<github-issue-number at the end
  • GOAL: Enforce every TODO comment to not have username (e.g. `// TODO(bartekpacia): ...)
  • NON GOAL: Check if the provided issue link/number is valid/exists/is really an issue (and not a PR or a discussion)

Question

I'm not sure how multiline TODOs should be treated. Should it be:

// TODO(bartekpacia): set reasonable duration or create new exception for this case
// See https://github.com/leancodepl/patrol/issues/2137

or:

// TODO(bartekpacia): set reasonable duration or create new exception for this case
// TODO(bartekpacia): See https://github.com/leancodepl/patrol/issues/2137

?

@bartekpacia bartekpacia added enhancement New feature or request p: leancode_lint Related to the leancode_lint package labels Nov 20, 2023
@shilangyu
Copy link
Contributor

So https://dart.dev/tools/linter-rules/flutter_style_todos but without the variant that has no link?

@bartekpacia
Copy link
Contributor Author

Yes, pretty much. I didn't know that lint exists, thanks.

@FirentisTFW
Copy link

Regarding multiline todos - how about prefixing them with a tab? They'd also be treated as a one TODO by VSC which we would not achieve using the options from the description (at least by default, according to my knowledge).

// TODO: set reasonable duration or create new exception for this case
//  See https://github.com/leancodepl/patrol/issues/2137

Screenshot 2023-11-20 at 15 02 39

@bartekpacia
Copy link
Contributor Author

Thanks @FirentisTFW - this is great. I'm curious whether the flutter_style_todos lint would recognize it in the same way as VSCode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request p: leancode_lint Related to the leancode_lint package
Projects
None yet
Development

No branches or pull requests

3 participants