Skip to content

Default version of quality tools configuration used in Magento 2 projects in Creatuity

Notifications You must be signed in to change notification settings

creatuity/magento-quality-tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 

Repository files navigation

GRUMPHP

Installation

composer require --dev creatuity/magento-quality-tools

DO NOT create a grumphp.yml file in the root directory when you will be prompted

Add the following to your composer.json

  "extra": {
    "grumphp": {
            "config-default-path": "vendor/creatuity/magento-quality-tools/src/grumphp.yml"
        }
  }

According to the issue with Magento Coding Standard package it's also needed to add this to your composer.json file

 "scripts": {
        "post-install-cmd": [
            "([ $COMPOSER_DEV_MODE -eq 0 ] || vendor/bin/phpcs --config-set installed_paths ../../magento/magento-coding-standard/,../../phpcompatibility/php-compatibility)"
        ]
    },

and run composer install to apply the changes.

Usage

  • Make sure that your changes are in GIT staging area.
  • When you want to commit your changes, type.
./vendor/bin/grumphp git:pre-commit

to run tasks defined in grumphp.yml only on the code from the commit. This command will be also run when you try to do a commit - it uses git pre-commit hook.

Built-in tasks

This package has pre-defined configuration of grumphp.yml file, thanks for that you can install and just use it. Currently, the package contains these tasks :

  • jsonlint
  • xmllint
  • phplint
  • yamllint
  • composer
  • phpcs
  • phpcsfixer2
  • phpmd
  • phpstan - Currently the level is set to 6
  • git_commit_message - This task validates a message in a commit. Allowed length of body and subject is limited to 120 characters. It also requires to begin a message from a task number, example - [PROJECTX-123] Test commit
  • git_branch_name - The task validates a branch name. It allows to use two type of branch names:
    • Task branches - which starts from hotfix|bugfix|feature prefix and contains a task number and short description, example - feature/PROJECTX-short-description
    • Release branches - release/0.1.1
  • git_blacklist - This task checks if a developer didn't use one of blacklisted words like var_dump or console.log

Compatibility

  • Magento >= 2.4.2
  • PHP version >= 7.2 || >= 8.1

Known Issues

  • If you're getting an error like this one :
Warning: class_implements(): Class Vendor\Module\Setup\Patch\Data\ExamplePatch does not exist and could not be loaded in /dev/tests/static/framework/Magento/CodeMessDetector/Rule/Design/AllPurposeAction.php on line 35

check this issue on the Github magento/magento2#33430

About

Default version of quality tools configuration used in Magento 2 projects in Creatuity

Resources

Stars

Watchers

Forks

Packages

No packages published