imscp / imscp-coding-standard
i-MSCP 编码规范
1.0.0
2019-03-14 09:26 UTC
Requires
This package is auto-updated.
Last update: 2024-08-29 05:06:37 UTC
README
包含所有编码规范规则的 i-MSCP 代码仓库。
安装
-
通过运行以下命令通过 composer 安装模块
$ composer require --dev imscp/imscp-coding-standard
-
将 composer 脚本添加到您的
composer.json
"scripts": { "cs-check": "phpcs", "cs-fix": "phpcbf" }
-
在您的仓库基础路径创建文件
phpcs.xml
,内容如下<?xml version="1.0"?> <ruleset name="i-MSCP Coding Standard"> <rule ref="./vendor/imscp/imscp-coding-standard/ruleset.xml"/> <!-- Paths to check --> <file>config</file> <file>src</file> <file>test</file> </ruleset>
您可以在该文件中添加或排除某些位置。有关参考,请参阅: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml
使用方法
-
仅运行检查
$ composer cs-check
-
自动修复许多 CS 问题
$ composer cs-fix