定制 griffbrad/phpstorm-cli-inspector 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

griffbrad/phpstorm-cli-inspector

Composer 安装命令:

composer require griffbrad/phpstorm-cli-inspector

包简介

README 文档

README

A tool to make it easier to run PHPStorm inspections on the command-line.

PHPStorm offers a variety of very helpful inspections to help you catch errors in your code. Many people don't realize that you can also run these inspections on the command-line without even opening the PHPStorm IDE. This is possible using the inspect.sh script that ships with PHPStorm, as documented here:

http://www.jetbrains.com/phpstorm/webhelp/working-with-phpstorm-features-from-command-line.html

Unfortunately, the arguments required to use this script are a bit tricky and easy to get wrong. On top of that, the output is just a bunch of XML files that group the issues based upon the type of the problem that was found, rather than the file the problem was found inside.

How does phpstorm-cli-inspector help?

To use PHPStorm's inspect.sh on a sub-directory of your project, you'd typically need to run this command:

/Applications/PhpStorm.app/bin/inspect.sh /delta/my-example-project/ /delta/my-example-project/.idea/inspectionProfiles/Project_Default.xml /tmp/output -d /delta/my-example-project/vendor/deltasystems/dewdrop/Dewdrop/Db/Dbdeploy/

After running the inspections, you'd look through the XML files to see the results.

With phpstorm-inspect, this command becomes just:

phpstorm-inspect /delta/my-example-project/vendor/deltasystems/dewdrop/Dewdrop/Db/Dbdeploy/

And the errors are displayed immediately in your terminal, grouped by the name of file they were found in. The path used in the phpstorm-inspect command can be any sub-directory inside your PHPStorm project's files. You don't have to manually point it at your inspection profile, .idea folder, etc. And the XML files are cleaned up for you automatically when the command completes.

Here's some example output:

$ ./bin/phpstorm-inspect /delta/my-example-project/vendor/deltasystems/dewdrop/Dewdrop/Db/Dbdeploy/
vendor/deltasystems/dewdrop/Dewdrop/Db/Dbdeploy/Changeset.php
=============================================================

* Line 169: PHPDoc comment doesn't contain all necessary @throws tag(s)

vendor/deltasystems/dewdrop/Dewdrop/Db/Dbdeploy/CliExec.php
===========================================================

* Line 198: PHPDoc comment doesn't contain all necessary @throws tag(s)

Installing phpstorm-inspect

You install phpstorm-inspect with Composer:

composer global require 'griffbrad/phpstorm-cli-inspector:>=1.0'
sudo ln -s ~/.composer/vendor/bin/phpstorm-inspect /usr/local/bin/phpstorm-inspect

Note that the above command assumes you've installed Composer globally as described here:

https://getcomposer.org/doc/00-intro.md#globally

FAQ

Does it work in Windows?

No. If any Windows users want to make it work, I'd be glad to accept pull requests.

What if PHPStorm is in a non-standard location?

You can add a .phpstorm-inspect.ini configuration file to your home folder. You can specify two things in that configuration: "inspectPath", which would point to the inspect.sh that ships with PHPStorm, and "excludePatterns", which should be regular expressions that will exclude matching problem descriptions.

统计信息

  • 总下载量: 44
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2014-05-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固