Skip to content

qbixx/smartvitaal-code-style

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

An opinionated custom coding standard

Table of contents

How to use

Enabling the rules

Add it to your project phpcs.xml or phpcs.xml.dist ruleset:

<?xml version="1.0"?>
<ruleset name="Smart Vitaal coding standard" namespace="smartvitaal/coding-standard">
    <arg name="basepath" value="."/>

    <file>./app</file>
    <file>./config</file>
    <file>./database</file>
    <file>./modules</file>
    <file>./resources</file>
    <file>./tests</file>

    <rule ref="./vendor/qbixx/smartvitaal-code-style/ruleset.xml"/>
</ruleset>

Sniffing code

The following commands can be added to the scripts section of your composer.json file to check and fix invalid code. Some optional checks are also included to illustrate how they might work together to check all your code.

{
    "scripts": {
        "composer-validate": "@composer validate --no-check-all --strict",
        "codesniffer-check": "vendor/bin/phpcs --runtime-set ignore_errors_on_exit 1 --runtime-set ignore_warnings_on_exit 1",
        "codesniffer-fix": "vendor/bin/phpcbf --runtime-set ignore_errors_on_exit 1 --runtime-set ignore_warnings_on_exit 1 || exit 0",
        "test": "vendor/bin/phpunit",
        "check": [
            "@composer-validate",
            "@codesniffer-check",
            "@test"
        ]
    }
}

Sniffing code in PHPStorm

See PHP Code Sniffer in PhpStorm on how to set up CodeSniffer in PHPStorm.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published