vimeo / psalm

A static analysis tool for finding errors in PHP applications
https://psalm.dev
MIT License
5.57k stars 660 forks source link

Allow changing output format #2305

Closed ruudk closed 5 years ago

ruudk commented 5 years ago

I want to run Psalm in a Github Action and let it annotate the PR for issues that it finds.

This annotation I can do easily with Reviewdog. That tool allows you to run any linter / analyzer and specify what format it produces.

For example

$ golint ./...
comment_iowriter.go:11:6: exported type CommentWriter should have comment or be unexported
$ golint ./... | reviewdog -efm="%f:%l:%c: %m" -diff="git diff master"

If I want to do this for Psalm, I need to tell Psalm that I want the following output:

<filename>:<line>:<column>: <error>

Are there any plans to allow different output formats?

weirdan commented 5 years ago

Psalm already supports several output formats with --output-format CLI switch. You can find the list of supported formats here: https://github.com/vimeo/psalm/blob/master/src/Psalm/Report.php#L8-L17

ruudk commented 5 years ago

How did I miss this 🤦‍♂ Thanks! pylint is what I need :)

cseufert commented 3 years ago

Just for anyone stumbling onto this via google, reviewdog can now read the psalm text output:

psalm --output-format=text $FILE | reviewdog -f=psalm -reporter=github-pr-check -nam="Psalm Check"