staabm/phpstan-todo-by

expire by version

staabm opened this issue ยท 8 comments

if the extension is running in a app which is git versioned, we may be able to find out, what the current and next version is, and therefore allow a variation of the rule, which invalidates comments by a version number instead of a date

Sometimes you just do workarounds until the next minor/major version is released with some needed changes.

needs a POC

similar to the todo_while macro in https://github.com/parker-codes/todo_by

It's a bit tricky, because versioning can be strictly Git-based (without any version string in the code), and I am not sure if PHPStan should be aware of it (especially that in CI it can be run in detached state). Also, these kind of errors should be reported before the release, so I am not sure how it could be handled to be really helpful - personally I wouldn't want the scenario where I tag the release and pipeline fails because of some comment was triggered after the release ๐Ÿ˜‰.

yeah, we would need some kind of next version prediction

I often encounter todos like "do X after next release" or "after x is merged" to make sure that internal dependencies are met.

I often encounter these todos long after the requirement has been fulfilled as no one actually looked through these comments.

So having a rule that would trigger on such rules would indeed be helpful.

Regarding the versions: There could always be a config file that needs to be adapted manually (or via a build process) when creating a new version (whichever that is).

Similar possibly for merging branches or [PM]Rs...

Configurable list of regexes that should trigger the error would be enough, I think ๐Ÿค”.

I think the actual problem is to know when we want the errors to trigger.

e.g. if I put a // todo X after next release into the source, it should not error immediately, but after/right before the event happened.

In #10 I have implemented a idea, which allows you to define the reference time. That way you can e.g. use a env var to see expired comments in DEV earlier

hey guys,

in #12 I have implemented a "todo-by-version" rule.
its released with https://github.com/staabm/phpstan-todo-by/releases/tag/0.1.7 - please give it a try.

see the projects README

feedback would be awesome.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.