每天从命令行获取 PHP lint/PhpStorm 检查错误 [英] Getting PHP lint / PhpStorm inspect errors every day from command line

查看:91
本文介绍了每天从命令行获取 PHP lint/PhpStorm 检查错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每天尝试从命令行运行某种形式的 PHP linting.

Attempting to run a form of PHP linting from the command line, daily.

我已经尝试过 SonarLint - 在 PhpStorm 中很可爱,但遗憾的是他们显然已经停止支持命令行命令.

I've tried SonarLint - lovely in PhpStorm, but sadly they've apparently stopped supporting command line commands.

我尝试获取 PHPLint 和 php -l,但我不是 php 大师,并且正在努力处理作曲家文件.

I tried to get PHPLint and php -l but I'm no php guru and was struggling with composer files.

最后,我查看了 PhpStorm 检查 - 我可以让它创建一个包含 99 种错误类型的目录,但随后我必须编写一个工具来 grep 文件并查看/count 错误、警告看看它们是否每天都在上升/下降,或者在 IDE 中检查,这两个都不是特别吸引人.

Finally I looked at PhpStorm inspect - I can get it to create a directory of 99 types of errors, it seems, but then I'd have to either write a tool to grep the files and look /count errors, warnings to see if they're going up / down daily, or check it in the IDE, neither of which are particularly appealing.

必须有一个工具可以产生一个很好的简单输出,我可以将其合并为构建管道的一部分,每天或每次构建后绘制错误/警告图表?

There must be a tool that produces a nice simple output that I can incorporate as part of a build pipeline, graphing errors/warnings either daily or after each build?

推荐答案

Try PHPStan (PHP Static分析工具),支持 CLI 执行.这也与 composer 一起安装(这几乎是默认设置);大多数 PHP IDE 都支持开箱即用的 composer.很可能你不会发现很多不会安装的包,除非手动将它们放入包含路径(这不会给你自动加载器的功能).

Try PHPStan (PHP Static Analysis Tool), which supports CLI execution. This is also installed with composer (which is pretty much the default); most PHP IDE support composer out-of-the-box. Likely you won't find that many packages that won't be installed alike that, unless manually dropping them into an include path (this just won't give you the auto-loader capabilities).

这篇关于每天从命令行获取 PHP lint/PhpStorm 检查错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆