Sign inSign up

conv/phpcs

By conv

Updated over 4 years ago

Image
0

901

conv/phpcs repository overview

Create a .phpcs.xml file in your project root like (example for Laravel):

<?xml version="1.0"?>

<ruleset  name="PHP_CodeSniffer">

    <description>PHPCS configuration file.</description>
    <!-- check all files in the app directory, feel free to add more files with:
    <file>FOLDER NAME</file>
    -->

    <file>app</file>

    <!-- exclude our migrations directory from the violation check-->
    <exclude-pattern>*/database/*</exclude-pattern>
    <exclude-pattern>*/cache/*</exclude-pattern>
    <exclude-pattern>*/lang/*</exclude-pattern>
    <exclude-pattern>*/*.js</exclude-pattern>
    <exclude-pattern>*/*.css</exclude-pattern>
    <exclude-pattern>*/*.xml</exclude-pattern>
    <exclude-pattern>*/*.blade.php</exclude-pattern>
    <exclude-pattern>*/autoload.php</exclude-pattern>
    <exclude-pattern>*/storage/*</exclude-pattern>
    <exclude-pattern>*/docs/*</exclude-pattern>
    <exclude-pattern>*/vendor/*</exclude-pattern>
    <exclude-pattern>*/migrations/*</exclude-pattern>

    <!-- ignore warnings and display ERRORS only -->
    <arg  value="np"/>

    <ini name="memory_limit" value="128M"/>

    <!-- Our base rule: set to PSR12-->
    <rule  ref="PSR12">
        <exclude name="PSR12.Files.FileHeader.SpacingInsideBlock"/>
    </rule>

</ruleset>

then run phpsc with docker run --rm -v $PWD:/code conv/phpcs:latest

Tag summary

Content type

Image

Digest

Size

33.2 MB

Last updated

over 4 years ago

docker pull conv/phpcs