staabm / phpstan-todo-by

Todo comments with expiration
https://staabm.github.io/2023/12/17/phpstan-todo-by-published.html
MIT License
173 stars 4 forks source link

Get an error for a TODO without an expiration constraint #87

Open Deuchnord opened 6 months ago

Deuchnord commented 6 months ago

Hello, great package!

I may have not searched correctly, but is there a way to get PhpStan fail with an error if a TODO exists without an expiration constraint?

For instance, if I write:

// TODO: write tests

I'd like to configure phpstan-todo-by in a way it will reject my TODO until I set a condition.

Is it possible?

staabm commented 6 months ago

hey,

its not yet possible. I think it would be a good idea though to optionally report invalid TODO comments.

staabm commented 3 months ago

hmm thinking again about it.. most comments usually not have a expiration and forcing people to write a expiration condition sounds like a frustrating experience

Deuchnord commented 3 months ago

hmm thinking again about it.. most comments usually not have a expiration and forcing people to write a expiration condition sounds like a frustrating experience

Why not making this an option disabled by default, to prevent it to break PhpStan if this behavior is not wanted?

staabm commented 3 months ago

to prevent it to break PhpStan if this behavior is not wanted?

could you elaborate on how this "breaks phpstan"?

Why not making this an option disabled by default

I can think of a project in which you really want a expire condition on every comment in the codebase. this sounds like a hurdle which might prevent people from commenting stuff at all

gharlan commented 3 months ago

I can think of a project in which you really want a expire condition on every comment in the codebase.

Not on every comment, but on every todo comment (@todo etc.). While working on bigger features I often use temporary todo comments which should be fixed before merging into main. So in my main branch all todo comments should have an expiration.