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

Add TodoByTicketRule (issue tracker support) #26

Closed EmilMassey closed 8 months ago

EmilMassey commented 9 months ago

Hi!

First of all, thank you for this extension, because it allowed me to easily create something I needed for my personal project: to analyze codebase for todos with JIRA ticket keys and to make sure commented code has been fixed in the referenced tickets.

I noticed that your extension is getting more and more features so I decided to create this Pull Request with the changes I made to support my need to fetch statuses from JIRA. Maybe someone else is looking for such a feature and maybe you'll find it useful for your project.

I'm not sure though if it is expected from static analyzer to make API calls to some external provider but I made this rule optional (can be allowed with a flag in parameters). Currently only JIRA is supported but in the future this could also include other issue trackers. At the moment only basic authentication with Personal Access Token or user password is supported which was enough for my personal use case on local machine but most of organizations run their phpstan analysis in CI so if this PR is accepted, I'll work on changes to support OAuth tokens which are more appropriate for this use case.

If you would like to include this feature in your project, please feel free to share your comments and suggestions so I can work on this to match the vision you have for this extension.

DannyvdSluijs commented 8 months ago

👀 This seems like an interesting development. I’m currently using Youtrack. So once this PR is merged (or about to) I could check if I can add support for Youtrack in a new PR.

EmilMassey commented 8 months ago

I think, it's ready to be merged now unless anyone has some more suggestions or see potential issues. I ran it on some of my projects and it works well.

staabm commented 8 months ago

just a few nits. will merge after that

staabm commented 8 months ago

thank you - released in https://github.com/staabm/phpstan-todo-by/releases/tag/0.1.16