2017 © Pedro Peláez
 

library coding-standards

Coding standards definition compatible with PSR-2

image

shopsys/coding-standards

Coding standards definition compatible with PSR-2

  • Monday, July 16, 2018
  • by sustmi
  • Repository
  • 8 Watchers
  • 17 Stars
  • 6,042 Installations
  • PHP
  • 13 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 29 Versions
  • 22 % Grown

The README.md

Shopsys Coding Standards

Build Status Downloads, (*1)

Shopsys Coding Standards are based on PSR-2., (*2)

This project bundles tools along with predefined rulesets for automated checks of Shopsys Coding Standards that we use in many Shopsys projects. The repository also contains few custom rules., (*3)

This repository is maintained by shopsys/shopsys monorepo, information about changes is in monorepo CHANGELOG.md., (*4)

Provided tools:, (*5)

For further information see official documentation of those tools., (*6)

Installation

php composer require shopsys/coding-standards

Usage

Create easy-coding-standard.yml config file in your project which includes predefined ruleset. You can also customize the rules and even add your own sniffs and fixers in the config., (*7)

#easy-coding-standard.yml
imports:
   - { resource: '%vendor_dir%/shopsys/coding-standards/easy-coding-standard.yml' }

In terminal, run following commands:, (*8)

php vendor/bin/parallel-lint /path/to/project
php vendor/bin/ecs check /path/to/project --config=/path/to/project/custom-coding-standard.yml

Custom rules

Rules for PHP-CS-Fixer

Shopsys/missing_button_type

All <button> HTML tags in .html and .html.twig files must have explicit type attribute., (*9)

If the type is not specified it will be fixed to type="button"" because the implicit value is submit which makes it behave differently based on the context (<button> inside <form> element submits the form)., (*10)

Shopsys/orm_join_column_require_nullable

Doctrine annotations @ORM\ManyToOne and @ORM\OneToOne must have nullable option defined explicitly in @ORM\JoinColumn., (*11)

If the nullable option is not specified it will be fixed to nullable=false because the implicit value is true but this is the opposite to the implicit value of nullable for @Column annotation. This makes it consistent., (*12)

Rules for PHP_CodeSniffer

ForbiddenExitSniff

Function exit() is not allowed., (*13)

ForbiddenSuperGlobalSniff

Usage of superglobals ($_COOKIE, $_GET, $_FILES, $_POST, $_REQUEST, $_SERVER) is not allowed., (*14)

ObjectIsCreatedByFactorySniff

Instantiation of objects that can be created by their factories is not allowed outside of the factory., (*15)

ValidVariableNameSniff

Default \PHP_CodeSniffer\Standards\Squiz\Sniffs\NamingConventions\ValidVariableNameSniff does not report method parameters in $_var format as an violation but it should. It also skips checking of private members when PrivateNoUnderscore property is disabled., (*16)

This sniff provides the missing functionality and is intended to be used as an addition to the default ValidVariableNameSniff., (*17)

Contributing

Thank you for your contributions to Shopsys Coding Standards package. Together we are making Shopsys Framework better., (*18)

This repository is READ-ONLY. If you want to report issues and/or send pull requests, please use the main Shopsys repository., (*19)

Please, check our Contribution Guide before contributing., (*20)

Support

What to do when you are in troubles or need some help? The best way is to join our Slack., (*21)

If you want to report issues, please use the main Shopsys repository., (*22)

The Versions

21/06 2018

v7.0.0-alpha3

7.0.0.0-alpha3

Coding standards definition compatible with PSR-2

  Sources   Download

MIT

The Requires

 

The Development Requires

coding standards psr-2 code style code quality

31/05 2018

dev-bb-upgrade-coding-standards

dev-bb-upgrade-coding-standards

Coding standards definition compatible with PSR-2

  Sources   Download

MIT

The Requires

 

The Development Requires

coding standards psr-2 code style code quality

24/05 2018

v7.0.0-alpha2

7.0.0.0-alpha2

Coding standards definition compatible with PSR-2

  Sources   Download

MIT

The Requires

 

The Development Requires

coding standards psr-2 code style code quality

17/04 2018

v3.x-dev

3.9999999.9999999.9999999-dev

Coding standards definition compatible with PSR-2

  Sources   Download

MIT

The Requires

 

The Development Requires

coding standards psr-2 code style code quality

12/04 2018

v7.0.0-alpha1

7.0.0.0-alpha1

Coding standards definition compatible with PSR-2

  Sources   Download

MIT

The Requires

 

The Development Requires

coding standards psr-2 code style code quality

27/03 2018

dev-ph-travis

dev-ph-travis

Coding standards definition compatible with PSR-2

  Sources   Download

MIT

The Requires

 

The Development Requires

coding standards psr-2 code style code quality

08/03 2018

dev-msatestmaster

dev-msatestmaster

Coding standards definition compatible with PSR-2

  Sources   Download

MIT

The Requires

 

The Development Requires

coding standards psr-2 code style code quality

08/03 2018

dev-msatestmastertwo

dev-msatestmastertwo

Coding standards definition compatible with PSR-2

  Sources   Download

MIT

The Requires

 

The Development Requires

coding standards psr-2 code style code quality

15/02 2018

dev-ss-documentation-github

dev-ss-documentation-github

Coding standards definition compatible with PSR-2

  Sources   Download

MIT

The Requires

 

The Development Requires

coding standards psr-2 code style code quality

27/01 2018

v4.0

4.0.0.0

Coding standards definition compatible with PSR-2

  Sources   Download

MIT

The Requires

 

The Development Requires

coding standards psr-2 code style code quality

27/01 2018

dev-split-test

dev-split-test

Coding standards definition compatible with PSR-2

  Sources   Download

MIT

The Requires

 

The Development Requires

coding standards psr-2 code style code quality

25/01 2018

dev-rv-rc-4.0

dev-rv-rc-4.0

Coding standards definition compatible with PSR-2

  Sources   Download

MIT

The Requires

 

The Development Requires

coding standards psr-2 code style code quality

31/10 2017

v3.1.1

3.1.1.0

Coding standards definition compatible with PSR-2

  Sources   Download

MIT

The Requires

 

The Development Requires

coding standards psr-2 code style code quality

12/10 2017

v3.1.0

3.1.0.0

Coding standards definition compatible with PSR-2

  Sources   Download

MIT

The Requires

 

The Development Requires

coding standards psr-2 code style code quality

13/09 2017

dev-test

dev-test

Coding standards definition compatible with PSR-2

  Sources   Download

MIT

The Requires

 

The Development Requires

coding standards psr-2 code style code quality

04/07 2017

dev-tl-extension-of-automatic-tests

dev-tl-extension-of-automatic-tests

Coding standards definition compatible with PSR-2

  Sources   Download

MIT

The Requires

 

The Development Requires

coding standards psr-2 code style code quality

15/03 2017

v3.0.2

3.0.2.0

Coding standards definition compatible with PSR-2

  Sources   Download

MIT

The Requires

 

The Development Requires

coding standards psr-2 code style code quality

06/03 2017

v3.0.1

3.0.1.0

Coding standards definition compatible with PSR-2

  Sources   Download

MIT

The Requires

 

The Development Requires

coding standards psr-2 code style code quality

06/03 2017

v3.0.0

3.0.0.0

Coding standards definition compatible with PSR-2

  Sources   Download

MIT

The Requires

 

The Development Requires

coding standards psr-2 code style code quality

14/02 2017

v2.0.1

2.0.1.0

Common coding standards for new ShopSys projects

  Sources   Download

The Requires

 

The Development Requires

by Miroslav Sustek

13/02 2017

v2.0.0

2.0.0.0

Common coding standards for new ShopSys projects

  Sources   Download

The Requires

 

The Development Requires

by Miroslav Sustek

07/02 2017

v1.2.3

1.2.3.0

Common coding standards for new ShopSys projects

  Sources   Download

The Requires

 

The Development Requires

by Miroslav Sustek

06/01 2017

v1.2.2

1.2.2.0

Common coding standards for new ShopSys projects

  Sources   Download

The Requires

 

The Development Requires

by Miroslav Sustek

27/04 2016

v1.2.1

1.2.1.0

Common coding standards for new ShopSys projects

  Sources   Download

The Requires

 

The Development Requires

by Miroslav Sustek

14/03 2016

v1.2.0

1.2.0.0

Common coding standards for new ShopSys projects

  Sources   Download

The Requires

 

The Development Requires

by Miroslav Sustek

29/02 2016

v1.1.0

1.1.0.0

Common coding standards for new ShopSys projects

  Sources   Download

The Requires

 

The Development Requires

by Miroslav Sustek

18/12 2015

v1.0.0

1.0.0.0

Common coding standards for new ShopSys projects

  Sources   Download

The Requires

 

by Miroslav Sustek