shopsys/phpstorm-inspect
Composer 安装命令:
composer require shopsys/phpstorm-inspect
包简介
Package for running PhpStorm's inspections from CLI and displaying results
README 文档
README
This package enables you to comfortably use PhpStorm as a CLI tool for static analysis.
Basically, it is a wrapper for PhpStorm's inspect.sh script that does some extra work:
- waits for PhpStorm to finish already running inspections (because PhpStorm cannot run more instances of
inspect.shin simultaneously; see IDEA-150272) - clears PhpStorm's cache before every run in order to prevent stale cache issues (otherwise PhpStorm sometimes fails to see new files when switching GIT branches)
- parses XML output generated by PhpStorm and presents it in a readable form (similar to tools like PHP CodeSniffer, PHPMD or PHP CS Fixer)
Usage
php bin/phpstorm-inspect <inspectShExecutableFilepath> <phpstormSystemPath> <projectPath> <inspectionProfileFilepath> <inspectedDirectory> [<format>]
Arguments description
inspectShExecutableFilepath- path toinspect.shscriptphpstormSystemPath- path to.WebIde*/systemdirectoryprojectPath- path to project directory (that contains.ideadirectory)inspectionProfileFilepath- path to inspection profile XML fileinspectedDirectory- path in which are the inspected sourcesformat (optional)- format of output result, accepted values: "text" (default value) / "checkstyle"
Example (text format)
php bin/phpstorm-inspect \ /opt/PhpStorm-139.1348/bin/inspect.sh ~/.WebIde80/system \ . .idea/inspectionProfiles/Project_Default.xml ./src
Output
File: /home/user/project/src/MyBundle/Controller/UserController.php
--------------------------------------------------------------------------------
Found 1 problems
--------------------------------------------------------------------------------
Line 17: Undefined field: Field 'usre' not found in class
--------------------------------------------------------------------------------
File: /home/user/project/src/MyBundle/Controller/ArticleController.php
--------------------------------------------------------------------------------
Found 2 problems
--------------------------------------------------------------------------------
Line 26: Unused local variable: Unused local variable $articleId
Line 32: Unreachable statement: Unreachable statement
--------------------------------------------------------------------------------
Example (checkstyle format)
php bin/phpstorm-inspect \ /opt/PhpStorm-139.1348/bin/inspect.sh ~/.WebIde80/system \ . .idea/inspectionProfiles/Project_Default.xml ./src checkstyle > report.xml
Content of report.xml
<?xml version="1.0"?>
<checkstyle version="1.0.0">
<file name="/home/user/project/src/MyBundle/Controller/UserController.php">
<error line="17" column="0" severity="warning" message="Undefined field: Field 'usre' not found in class" />
</file>
<file name="/home/user/project/src/MyBundle/Controller/ArticleController.php">
<error line="26" column="0" severity="warning" message="Unused local variable: Unused local variable $articleId" />
<error line="32" column="0" severity="warning" message="Unreachable statement: Unreachable statement" />
</file>
</checkstyle>
FAQ / Issues
Why should I use this package when I can simply run the inspections from IDE?
This package comes handy in environments where you do not have graphical interface.
For example, you can run static code analysis on your Continuous Integration server (eg. Jenkins).
Does CLI inspections work when PhpStorm IDE is running?
Unfortunately not. PhpStorm currently does not support running inspect.sh script when IDE is running. You need to close the IDE when you want to run inspections from CLI.
What PhpStorm versions are supported?
The package was tested with PhpStorm 8.0 (139.732) but the newer versions will probably work too.
shopsys/phpstorm-inspect 适用场景与选型建议
shopsys/phpstorm-inspect 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10.12k 次下载、GitHub Stars 达 41, 最近一次更新时间为 2017 年 03 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「inspection」 「phpstorm」 「code quality」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 shopsys/phpstorm-inspect 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 shopsys/phpstorm-inspect 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 shopsys/phpstorm-inspect 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Memio's PrettyPrinter, used to generate PHP code from given Model
The Cassandra php driver library IDE stubs which enables autocompletion in modern IDEs.
PhpStorm meta data for expected arguments completion in Doctrine projects.
Stubs to let Psalm understand Doctrine MongoDb ODM better
Repository resolver to show psalm how to resolve getRepository method
Yii2 component stubs generator for Yii::$app
统计信息
- 总下载量: 10.12k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 41
- 点击次数: 37
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-03-15