psalm-not-empty icon indicating copy to clipboard operation
psalm-not-empty copied to clipboard

Feature Request: Show code which would be altered as a plugin-specific issue

Open boesing opened this issue 2 years ago • 3 comments

Hey there,

I'd love to use this plugin as some kind of prevention. Recently added ForbiddenFunctions with empty and already report the usage of empty. But sadly, that does not provide a suggestion on how the code could be enhanced.

This is where this plugin could come in. I already played a little bit with plugin specific options in my plugin https://github.com/boesing/psalm-plugin-stringf#experimental which works quite well.

Would you mind adding this kind of "functionality" as an opt-in as well? Guess I can work on this once we settled on if this is something this plugin should do.

Happy to get some feedback. Thanks for your time.

boesing avatar May 25 '22 12:05 boesing

Hey! I'm pretty open to improving the plugin but I didn't quite caught what you want to add exactly. Could you rephrase maybe?

orklah avatar May 26 '22 16:05 orklah

When enabling this plugin, it pretty does nothing until used with psalter. What I was thinking about is, that in non-altering mode, psalm could report that empty should not be used while adding an example (as if it would alter the code) as an issue.

This could be enabled via opt-in (e.g. via an attribute in the psalm.xml) for example.

boesing avatar May 26 '22 17:05 boesing

Oh right, go ahead, I should have done that from the start! No need to add an opt-in, I prefer user to suppress the error instead if they don't want it

orklah avatar May 27 '22 14:05 orklah