digitronas/akeneo-coding-standard

Php standard automation.

0.3 2019-11-11 13:48 UTC

README

Combines EasyCodingStandard + GrumPHP + custom rules to provide static analysis to your project.

Install

composer require --dev digitronas/akeneo-coding-standard

Usage

Create grumphp.yml file in the root directory of your project and add:

parameters:
  tasks:
    ecs:
      config: 'vendor/digitronas/akeneo-coding-standard/ecs.yml'
      whitelist_patterns: ['.']

Notes:

  • the config property points to the ruleset of this package.
  • the whitelist_patterns is a list of directories that should be tested. Only .php files in those directories will be tested.

And that is it. GrumPHP won't allow to commit code that doesn't meet the standard.

Further reading

  • To bypass commit sniffing, see here.

  • To run grumphp manually, see here.

Contributing

To add or remove rules, first submit an issue to make sure your ideas aren't already in development and to make sure the project would approve your changes.

Clone this repository and run composer install. This will install ecs and grumphp. You might have to bypass grumphp, since it might not allow you to commit code if there are files that don't meet the standard.

Create a pull request to master branch. The changes will be merged after they pass code review.