creatuity / magento-quality-tools
The composer package basing on GrumPHP tool with pre-defined configuration for Magento projects
Installs: 4 594
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 0
Open Issues: 3
Requires
- php: ^7.2.0 || ^8.1.0
- bitexpert/phpstan-magento: ^0.24.0
- friendsofphp/php-cs-fixer: ~2.16 || ~3.3
- magento/magento-coding-standard: *
- overtrue/phplint: ^3.1
- php-parallel-lint/php-parallel-lint: ^1.3
- phpmd/phpmd: ^2.12
- phpro/grumphp-shim: ^1.13
- phpstan/extension-installer: ^1.1
- phpstan/phpstan: 1.8.*
- seld/jsonlint: ^1.9
- squizlabs/php_codesniffer: ^3.5.4
- symfony/yaml: ~5.3 || ~6.0
This package is not auto-updated.
Last update: 2024-11-12 14:24:08 UTC
README
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
- Task branches - which starts from
- git_blacklist - This task checks if a developer didn't use one of blacklisted words like
var_dump
orconsole.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