2017 © Pedro Peláez
 

phpcodesniffer-standard coding-standard

LEVIY Coding Standard

image

leviy/coding-standard

LEVIY Coding Standard

  • Monday, July 23, 2018
  • by nicwortel
  • Repository
  • 2 Watchers
  • 0 Stars
  • 2,926 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 19 Versions
  • 139 % Grown

The README.md

Leviy logo, (*1)

Leviy Coding Standard

Build status Packagist version PHP from Packagist, (*2)

The Leviy coding standard for PHP code, with rulesets for PHP CodeSniffer and PHP Mess Detector., (*3)

Installation

Install this package using Composer:, (*4)

composer require --dev leviy/coding-standard

Installing the PHP CodeSniffer ruleset

Create a file phpcs.xml in the root of the project with the following contents:, (*5)


<ruleset>
    <rule ref="LEVIY"/>

    <config name="ignore_warnings_on_exit" value="1"/>

    <arg name="extensions" value="php"/>

    <file>src/</file>
    <file>tests/</file>
    <file>public/index.php</file>
</ruleset>

Installing the PHP Mess Detector ruleset

Create a file phpmd.xml in the root of the project with the following contents:, (*6)


<ruleset xmlns="http://pmd.sf.net/ruleset/1.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
         name="Mess detector ruleset">
    <description>Ruleset for PHP Mess Detector that enforces coding standards</description>

    <rule ref="vendor/leviy/coding-standard/phpmd.xml"/>
</ruleset>

Configuration

PHP CodeSniffer

An annotated ruleset.xml configuration file can be found here where you can see the complete range of features and configuration options that can be used to modify the configuration to your project needs., (*7)

PHP Mess Detector

Documentation about tweaking the ruleset and exluding rules or changing settings can be found here., (*8)

Usage

Run vendor/bin/phpcs to run PHP CodeSniffer. If you have a file phpcs.xml or phpcs.xml.dist in root directory of the project, CodeSniffer will use it automatically. Add a path to run CodeSniffer only against that file or directory. See Usage for more detailed usage instructions., (*9)

Run vendor/bin/phpmd src/ text phpmd.xml to run PHP Mess Detector against the src directory and print a report in the "text" format., (*10)

PHPStorm code sniffer validation

  1. Open "Preferences" and navigate to "Editor > Inspections"., (*11)

  2. Enable "PHP > Quality tools > PHP_Code Sniffer validation"., (*12)

  3. Select a "Custom" coding standard., (*13)

  4. Select the path to the projects code sniffer configuration., (*14)

, (*15)

Enjoy the immediate feedback of code sniffer validation issues!, (*16)

, (*17)

The Versions

23/07 2018

dev-fix-missing-standards

dev-fix-missing-standards

LEVIY Coding Standard

  Sources   Download

proprietary

The Requires

 

The Development Requires

by LEVIY B.V. (Netherlands)

16/07 2018
16/07 2018
16/05 2018

dev-improve-tests

dev-improve-tests

LEVIY Coding Standard

  Sources   Download

proprietary

The Requires

 

The Development Requires

by LEVIY B.V. (Netherlands)

16/05 2018
16/05 2018
24/04 2018
23/04 2018

dev-update-phpcs-example-config

dev-update-phpcs-example-config

LEVIY Coding Standard

  Sources   Download

proprietary

The Requires

 

The Development Requires

by LEVIY B.V. (Netherlands)

23/04 2018

dev-travis-only-master

dev-travis-only-master

LEVIY Coding Standard

  Sources   Download

proprietary

The Requires

 

The Development Requires

by LEVIY B.V. (Netherlands)

23/04 2018

dev-add-phpmd-config

dev-add-phpmd-config

LEVIY Coding Standard

  Sources   Download

proprietary

The Requires

 

The Development Requires

by LEVIY B.V. (Netherlands)

12/02 2018

dev-travis-ci

dev-travis-ci

LEVIY Coding Standard

  Sources   Download

proprietary

The Requires

 

The Development Requires

by LEVIY B.V. (Netherlands)

03/10 2017

2.0.0

2.0.0.0

LEVIY Coding Standard

  Sources   Download

proprietary

The Requires

 

by LEVIY B.V. (Netherlands)

12/09 2017

1.0.1

1.0.1.0

LEVIY Coding Standard

  Sources   Download

proprietary

The Requires

 

by LEVIY B.V. (Netherlands)

09/09 2017

1.0.0

1.0.0.0

LEVIY Coding Standard

  Sources   Download

proprietary

The Requires

 

by LEVIY B.V. (Netherlands)