charonlab / coding-standard
Charon Lab 编码规范
1.2.0
2024-03-24 09:49 UTC
Requires
- php: ^8.1
- dealerdirect/phpcodesniffer-composer-installer: dev-master
- squizlabs/php_codesniffer: ^4.0.x-dev
Requires (Dev)
- roave/security-advisories: dev-master
This package is auto-updated.
Last update: 2024-08-24 11:02:57 UTC
README
安装
- 通过 composer 安装
composer require --dev charonlab/coding-standard
- 在您的存储库根目录下创建
phpcs.xml.dist
文件<?xml version="1.0"?> <ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd"> <arg name="basepath" value="."/> <arg name="cache" value=".phpcs-cache"/> <arg name="colors"/> <arg name="extensions" value="php"/> <arg name="parallel" value="80"/> <!-- Show progress --> <arg value="sp"/> <!-- Paths to check --> <file>src</file> <file>test</file> <!-- Include all rules from the CharonLab Coding Standard --> <rule ref="Charon"/> </ruleset>
- 将 composer 脚本添加到您的
composer.json
{ "scripts": { "cs": "phpcs", "cs-fix": "phpcbf -vpw" } }
使用方法
-
仅运行检查
composer run cs
-
自动修复违反编码规范的问题
composer run cs-fix
许可证
MIT 许可证 (MIT)。有关更多信息,请参阅 许可证。