承接 moxio/captainhook-psalm 相关项目开发

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

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

moxio/captainhook-psalm

最新稳定版本:v0.3.1

Composer 安装命令:

composer require moxio/captainhook-psalm

包简介

Captain Hook Plugin to check for newly introduced Psalm errors

README 文档

README

Latest Stable Version

moxio/captainhook-psalm

This project is a plugin for CaptainHook to check your staged PHP files for errors using Psalm. The commit is blocked when one or more errors is detected in any of the staged PHP files.

Installation

Install as a development dependency using composer:

$ composer require --dev moxio/captainhook-psalm

Usage

Add Psalm error checking as a pre-commit-hook to your captainhook.json configuration file:

{
    "pre-commit": {
        "enabled": true,
        "actions": [
            {
                "action": "\\Moxio\\CaptainHook\\Psalm\\PsalmCheckAction"
            }
        ]
    }
}

The check is only run when committing changes to PHP files. It will thus not detect pre-existing errors in PHP files which are not staged.

The action expects Psalm to be installed as a local Composer package (i.e. available at vendor/vimeo/psalm).

Conditional usage

If you want to perform Psalm-error checks only when Psalm is installed (i.e. available at vendor/vimeo/psalm), you can add a corresponding condition to the action:

{
    "pre-commit": {
        "enabled": true,
        "actions": [
            {
                "action": "\\Moxio\\CaptainHook\\Psalm\\PsalmCheckAction",
                "conditions": [
                    {
                        "exec": "\\Moxio\\CaptainHook\\Psalm\\Condition\\PsalmInstalled"
                    }
                ]
            }
        ]
    }
}

This may be useful in scenarios where you have a shared CaptainHook configuration file that is included both in projects that use Psalm and projects that don't. If Psalm is installed, the action is run. In projects without Psalm, the validation is skipped.

Influence of projectFiles in psalm.xml

If this plugin detects a psalm.xml configuration file, this plugin will try to use the projectFiles configured in that file to filter the files checked by Psalm. This is done on a best-effort basis: not all constructs possible within projectFiles are supported, but simple directories and files (along with ignoreFiles) should work fine. If you encounter a situation where files aren't properly filtered, feel free to send a PR.

Versioning

This project adheres to Semantic Versioning.

Contributing

Contributions to this project are welcome. Please make sure that your code follows the PSR-12 extended coding style.

License

This project is released under the MIT license.

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 4
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-05-07