psalm
psalm copied to clipboard
Show more info about issues when using "emacs" output format
It is great to be able to run Psalm inside Emacs with output format "emacs". However, some key information about issues are missing, which forces me to run Psalm outside the editor to see them. Of course, this defeats the purpose of the format entirely.
Things that I miss:
- Issue type
- Issue link to psalm.dev
For example, this is what I get inside Emacs:
helpers/Foo.php:168:16:error - $version is never referenced or the value is not used
job/Bar.php:195:45:error - Param #1 is never referenced in this method
I would love to see something like this:
helpers/Foo.php:168:16:error - UnusedVariable: $version is never referenced or the value is not used (see https://psalm.dev/077)
job/Bar.php:195:45:error - PossiblyUnusedParam: Param #1 is never referenced in this method (see https://psalm.dev/134)
Would there be any kind of downside if we change the emacs format for everyone? (maybe for people using small screens or multiple windows in a screen?)
The command is ran inside Emacs, which keeps track of newlines vs. wrapping, so I don't think there will be any issue. The examples I gave are short just to make the issue clear, but most of messages are wrapped already.
FYI: the benefits of the format is that Emacs understand the filename.php:line:column prefix, and is able to jump to the specific line/col. It also keeps track of added/removed lines. AFAIK, it doesn't care about the rest of the line.
Here's a screenshot of my environment at 80 cols wide:
Cool, then I guess you can propose a PR to change this! It should be pretty easy, here's the file that control this: https://github.com/vimeo/psalm/blob/4.x/src/Psalm/Report/EmacsReport.php
Great. And thanks for the pointer. I took a look at the code, it shouldn't be difficult, will try to find some time to work on this ASAP. Thanks