2017 © Pedro Peláez
 

phpcodesniffer-standard code-sniffer

Spryker Code Sniffer Standards

image

spryker/code-sniffer

Spryker Code Sniffer Standards

  • Monday, July 23, 2018
  • by dereuromark
  • Repository
  • 43 Watchers
  • 10 Stars
  • 134,039 Installations
  • PHP
  • 366 Dependents
  • 0 Suggesters
  • 3 Forks
  • 13 Open issues
  • 66 Versions
  • 28 % Grown

The README.md

Spryker Code Sniffer

CI Latest Stable Version Minimum PHP Version PHPStan License Total Downloads, (*1)

This sniffer package follows PSR-2 completely and ships with a lot of additional fixers on top (incl. PSR-12). Please see the Spryker Coding conventions for details., (*2)

List of included sniffs., (*3)

Documentation

See docs., (*4)

Upstream docs: squizlabs/PHP_CodeSniffer/wiki, (*5)

Usage

How to use in Spryker projects

Make sure you include the sniffer as require-dev dependency:, (*6)

composer require --dev spryker/code-sniffer

The Development module provides a convenience command:, (*7)

console code:sniff:style

(or console c:s:s as shortcut), (*8)

To automatically fix fixable errors, use, (*9)

console code:sniff:style -f

-v is useful for more info output. To run only a specific sniff, use the -s option. See -h for help., (*10)

You can also sniff a specific project level module or path:, (*11)

console code:sniff:style [-m ModuleName] [optional-sub-path] -v

How to use in any project

You can also manually invoke the phpcs/phpcbf commands:, (*12)

vendor/bin/phpcs --standard=vendor/spryker/code-sniffer/Spryker/ruleset.xml ./
vendor/bin/phpcbf --standard=vendor/spryker/code-sniffer/Spryker/ruleset.xml ./

The command phpcs just sniffs, phpcbf fixes., (*13)

You probably want to ignore some folders, e.g. --ignore=vendor/ or some of your test fixture folders., (*14)

Standards

You can always switch the standard to the stricter one named SprykerStrict. It is an extension of the Spryker standard with its own (strict) sniffs added on top., (*15)

How to include in your IDE

E.g. for PHPStorm: * Open Settings -> Tools -> External Tools * Add a new tool named "cs-sniffer" and set Program to $ProjectFileDir$/vendor/bin/phpcs, Parameters to --standard=$ProjectFileDir$/vendor/spryker/code-sniffer/Spryker/ruleset.xml -p $FilePath$ and Working directory to $ProjectFileDir$. * Add a new tool named "cs-fixer" and set Program to $ProjectFileDir$/vendor/bin/phpcbf, Parameters to --standard=$ProjectFileDir$/vendor/spryker/code-sniffer/Spryker/ruleset.xml -v $FilePath$ and Working directory to $ProjectFileDir$. * Remove the "Open console" if you don't want to see any output here for the fixer. * Now set up your hotkeys under Settings -> Keymap (search for cs-sniffer and cs-fixer). E.g. Control + Comma for sniffing, and Control + Dot for fixing., (*16)

You can also set up file watchers, but here you should better only whitelist certain sniffs that only add things and don't remove anything., (*17)

How to configure the default rule set

In order to simplify command line interface, phpcs allows to specify default rule set in and standards path the following way., (*18)

Assuming the following directory structure:, (*19)

vendor/spryker/code-sniffer/                          # Base directory
                           |_ Spryker/                # Rule set name
                                      |_ ruleset.xml  # Rule set

The base directory and rule set can be used in configuration now., (*20)

vendor/bin/phpcs --config-set installed_paths vendor/spryker/code-sniffer/
vendor/bin/phpcs --config-set default_standard Spryker

You might need to specify full directory path. Now the tools can be used without --standard switch., (*21)

Using own project standard

You can exchange or extend the Spryker coding standard by providing your own ruleset.xml. This can be configured in the Development module config:, (*22)

// DevelopmentConfig.php

    /**
     * Either a relative or full path to the ruleset.xml or a name of an installed
     * standard (see `phpcs -i` for a list of available ones).
     *
     * @return string
     */
    public function getCodingStandard()
    {
        return '/path/to/your/ruleset.xml';
    }

If you use it for custom projects, just use --standard to point to your ruleset file., (*23)

Make sure that you include the Spryker core standard ruleset in your custom one, e.g.:, (*24)


<ruleset name="SprykerProject">
    <description>
        Spryker Coding Standard for Project.
        Extends main Spryker Coding Standard.
        All sniffs in ./Sniffs/ will be auto loaded
    </description>

    <rule ref="vendor/spryker/code-sniffer/Spryker/ruleset.xml"/>

    <exclude-pattern>*/src/Generated/*</exclude-pattern>
    <exclude-pattern>*/src/Orm/*</exclude-pattern>
    <exclude-pattern>*/tests/_support/_generated/*</exclude-pattern>
    <exclude-pattern>*/tests/_helpers/*</exclude-pattern>
    <exclude-pattern>*/tests/_output/*</exclude-pattern>
    <exclude-pattern>./data/DE/*</exclude-pattern>

    <!-- Define your own sniffs here -->
</ruleset>

If you want to use the SprykerStrict standard in your project, you should replace the string:, (*25)

<rule ref="vendor/spryker/code-sniffer/Spryker/ruleset.xml"/>

with this one:, (*26)

<rule ref="vendor/spryker/code-sniffer/SprykerStrict/ruleset.xml"/>

The Versions

23/07 2018

dev-master

9999999-dev http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

18/07 2018

dev-bugfix/newlines

dev-bugfix/newlines http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

16/07 2018

dev-feature/constants

dev-feature/constants http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

16/07 2018

0.12.2

0.12.2.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

15/06 2018

dev-php71-ruleset

dev-php71-ruleset http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

15/06 2018

0.12.1

0.12.1.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

12/06 2018

0.12.0

0.12.0.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

23/05 2018

dev-feature/self

dev-feature/self http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

25/04 2018

dev-feature/nullable

dev-feature/nullable http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

25/04 2018

0.11.4

0.11.4.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

24/04 2018

dev-bugfix/nullable

dev-bugfix/nullable http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

26/03 2018

0.11.3

0.11.3.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

16/02 2018

dev-bugfix/demoshop-check

dev-bugfix/demoshop-check http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

15/01 2018

0.11.2

0.11.2.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

15/01 2018

dev-bugfix/test

dev-bugfix/test http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

30/11 2017

0.11.1

0.11.1.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

12/10 2017

0.11.0

0.11.0.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

10/10 2017

0.10.4

0.10.4.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

12/09 2017

0.10.3

0.10.3.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

07/09 2017

0.10.2

0.10.2.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

31/08 2017

dev-bugfix/project-default

dev-bugfix/project-default http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

31/08 2017

0.10.1

0.10.1.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

18/08 2017

0.10.0

0.10.0.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

01/08 2017

0.9.5

0.9.5.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

17/07 2017

0.9.4

0.9.4.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

17/07 2017

0.9.3

0.9.3.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

10/06 2017

dev-feature/use-with-leading-backslash

dev-feature/use-with-leading-backslash http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

09/06 2017

dev-multi-store-exclude-patterns

dev-multi-store-exclude-patterns http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

19/05 2017

0.9.2

0.9.2.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

12/05 2017

0.9.1

0.9.1.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

26/04 2017

0.9.0

0.9.0.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

06/04 2017

0.8.2

0.8.2.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

29/03 2017

dev-feature/new-tests-sniffer-for-docblocks

dev-feature/new-tests-sniffer-for-docblocks http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

17/03 2017

0.8.1

0.8.1.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

06/03 2017

dev-develop

dev-develop http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

06/03 2017

0.8.0

0.8.0.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

06/02 2017

0.7.2

0.7.2.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

30/01 2017

dev-test-namespace

dev-test-namespace http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

05/01 2017

dev-develop-alternative

dev-develop-alternative http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

05/01 2017

0.7.1

0.7.1.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

03/01 2017

0.7.0

0.7.0.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

02/01 2017

0.6.11

0.6.11.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

13/12 2016

dev-feature/facade

dev-feature/facade http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

06/12 2016

0.6.10

0.6.10.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

30/11 2016

0.6.9

0.6.9.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

15/11 2016

0.6.8

0.6.8.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

31/10 2016

0.6.7

0.6.7.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

21/10 2016

0.6.6

0.6.6.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

08/09 2016

dev-feature/static-vs-self

dev-feature/static-vs-self http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

06/09 2016

0.6.5

0.6.5.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

26/08 2016

0.6.4

0.6.4.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

23/08 2016

0.6.3

0.6.3.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

19/08 2016

0.6.2

0.6.2.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

18/08 2016

0.6.1

0.6.1.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

09/08 2016

0.6.0

0.6.0.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

27/07 2016

0.5.2

0.5.2.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

18/07 2016

0.5.1

0.5.1.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

11/07 2016

0.5

0.5.0.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

05/07 2016

0.4.3

0.4.3.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

17/06 2016

0.4.2

0.4.2.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

06/06 2016

0.4.1

0.4.1.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

06/06 2016

0.4.0

0.4.0.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

13/04 2016

0.3.1

0.3.1.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

16/03 2016

0.3

0.3.0.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

MIT

The Requires

 

The Development Requires

framework phpcs codesniffer standards

26/02 2016

0.2

0.2.0.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

framework phpcs codesniffer standards

12/02 2016

0.1

0.1.0.0 http://spryker.com

Spryker Code Sniffer Standards

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

framework phpcs codesniffer standards