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

Ability to add multiple TODO across the code, but refering to the same issue? #215

Open
naps62 opened this issue Oct 14, 2024 · 3 comments

Comments

@naps62
Copy link
Contributor

naps62 commented Oct 14, 2024

I know we can use TODO(#99), but that requires the issue number to already exist.

In my use cases, I often have to add a TODO in multiple parts of the codebase, but with it being actually the same overall task (e.g. some missing feature that, once implemented, will require my attention in various points of the code).

Is it possible to somehow have all these comments (written during the same PR) end up creating a single issue?

@alstr
Copy link
Owner

alstr commented Oct 14, 2024

Not at this stage. You'd have to create the issue first, then you could use that issue number in each TODO to add to it.

The challenge when when the issue doesn't already exist is how to tie separate code blocks together. There'd have to be some sort of common identifier. It's doable, but I'm not sure what that would be.

@rgalonso
Copy link
Contributor

rgalonso commented Dec 2, 2024

Perhaps a way to handle this would be to support a placeholder reference. e.g.

+ // TODO(new): fix the widget

All references to new would be replaced with the same new issue number.

Like for URL Insertion, this would require that the workflow include steps to set the Git user and commit/push changes.

This could be extended to support multiple new issues in the same run.

+ // TODO(new-1): add function documentation
int transform(int input) {
-   in output = input*20 + 5;
+   int output = input*20 + 5; // TODO(new-2): replace magical numbers
  return output;
}

+ // TODO(new-1): add function documentation
int inverseTransform(int input) {
-   int output = (input - 5)/20;
+   int output = (input - 5)/20; // TODO(new-2): replace magical numbers
  return output;
}

(new and new-1 should be treated equivalently.)

What do you think of this approach?


There would have to be some rules/checks about the issue title. i.e. what if in the last changed line above they had written it differently, or simply had a typo? (e.g. replace magcial numbres) Which is the "right" title to use? There are likely other corner cases that would need to be considered, but I wanted to record that one since it already occurred to me now.

@alstr
Copy link
Owner

alstr commented Dec 5, 2024

Yes, that's a good idea, maybe with some kind of unambiguous symbol prepended, to maintain consistency with the other functionality, e.g. TODO(*new).

I suppose it comes down to how useful/widely used it would be vs the complexity to implement. I can see the value in it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants