webimpress/coding-standard

Webimpress Coding Standard

Maintainers

👁 webimpress

Package info

github.com/webimpress/coding-standard

Type:phpcodesniffer-standard

pkg:composer/webimpress/coding-standard

Fund package maintenance!

michalbundyra

Statistics

Installs: 2 294 357

Dependents: 36

Suggesters: 0

Stars: 15

Open Issues: 9

1.4.0 2024-10-16 06:55 UTC

Requires

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

BSD-2-Clause 6f6a1a90bd9e18fc8bee0660dd1d1ce68cf9fc53

phpcsCoding StandardPSR-2psr-12webimpress


README

👁 Unit Tests
👁 Coding Standards
👁 Coverage Status

Installation

  1. Install the module via composer by running:

    $ composer require --dev webimpress/coding-standard
  2. Add composer scripts into your composer.json:

    "scripts": {
     "cs-check": "phpcs",
     "cs-fix": "phpcbf"
    }
  3. Create file phpcs.xml in base path of your repository with content:

    <?xml version="1.0"?>
    <ruleset name="Webimpress Coding Standard"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:noNamespaceSchemaLocation="./vendor/squizlabs/php_codesniffer/phpcs.xsd">
     <rule ref="./vendor/webimpress/coding-standard/ruleset.xml"/>
    
     <!-- Paths to check -->
     <file>config</file>
     <file>src</file>
     <file>test</file>
    </ruleset>

As shown above you must define locations or files you want to be checked and fixed by code sniffer. For a reference please see: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-Ruleset

Usage

  • To run checks only:

    $ composer cs-check
  • To automatically fix many CS issues:

    $ composer cs-fix