spiral/code-style
最新稳定版本:v2.3.1
Composer 安装命令:
composer require spiral/code-style
包简介
Code style and static analysis tools rulesets collection
README 文档
README
This repository contains ruleset for PHP CS Fixer based on PER-2.
Installation and configuration
Install the package via composer:
composer require --dev spiral/code-style
Create a configuration file .php-cs-fixer.dist.php in the root of your project:
<?php declare(strict_types=1); require_once 'vendor/autoload.php'; return \Spiral\CodeStyle\Builder::create() ->include(__DIR__ . '/src') ->include(__FILE__) ->build();
Feel free to adjust the paths to include/exclude files and directories.
Usage
To more convenient usage, you can add the following commands to the scripts section of the composer.json file:
{
"scripts": {
"cs:diff": "php-cs-fixer fix --dry-run -v --diff",
"cs:fix": "php-cs-fixer fix -v"
}
}
Now you can run the following commands:
composer cs:diff composer cs:fix
CI integration
If you want to integrate code style check into CI, add the following step to your GitHub Actions configuration file:
on: push: branches: - '*' name: Check Code Style jobs: cs-check: uses: spiral/gh-actions/.github/workflows/cs.yml@master
If you want GitHub Actions to automatically fix the found errors, add the following step:
on: push: branches: - '*' name: Fix Code Style jobs: cs-fix: permissions: contents: write uses: spiral/gh-actions/.github/workflows/cs-fix.yml@master
统计信息
- 总下载量: 349.75k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 1
- 依赖项目数: 82
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-10-09