ionbytes / coding-standard

IonBytes 编码规范

安装: 130

依赖: 0

建议者: 0

安全: 0

星标: 0

关注者: 1

分支: 0

公开问题: 0

类型:phpcodesniffer-standard

1.0.0 2024-04-04 04:07 UTC

This package is not auto-updated.

Last update: 2024-09-21 20:25:56 UTC


README

安装

  1. 通过运行 composer 安装
    composer require --dev ionbytes/coding-standard
  2. 在您仓库的根目录下创建 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>tests</file>
        
        <!-- Include all rules from the IonBytes Coding Standard -->
        <rule ref="IonBytes"/>
    </ruleset>
  3. 将 composer 脚本添加到您的 composer.json
    {
      "scripts": {
        "cs-check": "phpcs",
        "cs-fix": "phpcbf -vpw"
      }
    }

使用方法

  • 仅运行检查

    composer run cs
  • 自动修复违反编码标准的问题

    composer run cs-fix

许可证

MIT 许可证(MIT)。请参阅 许可证 了解更多信息