charonlab/coding-standard

Charon Lab Coding Standard

Installs: 394

Dependents: 4

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:phpcodesniffer-standard

1.2.0 2024-03-24 09:49 UTC

This package is auto-updated.

Last update: 2024-10-24 11:23:41 UTC


README

Installation

  1. Install via composer
    composer require --dev charonlab/coding-standard
  2. Create the phpcs.xml.dist file in root path of you repository
    <?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>
  3. Add composer scripts into your composer.json
    {
      "scripts": {
        "cs": "phpcs",
        "cs-fix": "phpcbf -vpw"
      }
    }

Usage

  • To run checks only:

    composer run cs
  • To automatically fix violations coding standards:

    composer run cs-fix

License

The MIT License (MIT). Please see License for more information.