承接 shopsys/phpstorm-inspect 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

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.sh in 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 to inspect.sh script
  • phpstormSystemPath - path to .WebIde*/system directory
  • projectPath - path to project directory (that contains .idea directory)
  • inspectionProfileFilepath - path to inspection profile XML file
  • inspectedDirectory - path in which are the inspected sources
  • format (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 我们能提供哪些服务?
定制开发 / 二次开发

基于 shopsys/phpstorm-inspect 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 10.12k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 41
  • 点击次数: 37
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 41
  • Watchers: 18
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-03-15