Help with Script and Regex Linter



I’m trying to add phpstan to the arc lint workflow, as explained in documentation, but I’m unable to capture the error message. Here are my files:


“phpstan”: {
“type”: “script-and-regex”,
“include”: “(\\.php$)”,
“script-and-regex.script”: “sh -c 'phpstan analyse -l 0 -c var/build/phpstan.neon --no-progress --errorFormat=raw \”$0\" || true’",
“script-and-regex.regex”: “/^(?P<name>):(?P<line>):(?P<message>.*)$/m”

Example of error message:

$>sh -c ‘phpstan analyse -l 0 -c var/build/phpstan.neon --no-progress --errorFormat=raw “$0” || true’ ‘src/AppBundle/Model/Articulos/ArticuloDocnet.php’

/private/var/www/ws/src/AppBundle/Model/Articulos/ArticuloDocnet.php:36:AppBundle\Model\Articulos\ArticuloDocnet::__construct() does not call parent constructor from Aicrag\Util\Produccion\Articulo.

When I run arc lint it’s always saying no lint warnings. I tried without the || true and it raises an exception.

I tried with the simplest valid regex shown in documentation (/^(?P<message>.*)$/m) and it finds the error in that file, but then all the other files (that doesn’t have any error) make phpstan crash saying memory consumption. I have memory_limit=2G, so I don’t think it’s a memory problem. Maybe the regex with an empty string.

Does anybody have phpstan or a similar tool working with arc lint?

Thank you in advance.



If anybody else wants to lint with phpstan, I ended up developing a linter based on another one I saw in Community Resources.