Skip to content

Instantly share code, notes, and snippets.

@rafaelstz
Last active May 22, 2023 20:03
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rafaelstz/649922a3c98d7c2e781d52c771ccd566 to your computer and use it in GitHub Desktop.
Save rafaelstz/649922a3c98d7c2e781d52c771ccd566 to your computer and use it in GitHub Desktop.
Configure GrumPHP in your Magento 2 to check: Composer, PHPCS, PHPMD, PHPCSFixer, PHPCPD, PHPLint, Security Checker, XML Lint.

Install GrumPHP in your Magento 2

Create the grumphp.yml in the root folder of your project and run these commands below:

    composer require "phpro/grumphp:^0.14" --dev
    composer require nlubisch/grumphp-easycodingstandard --dev
    composer require wearejust/grumphp-extra-tasks --dev
    composer require jakub-onderka/php-parallel-lint --dev   
parameters:
magento_dir: .
bin_dir: "./vendor/bin"
stop_on_failure: false
ignore_unstaged_changes: false
hide_circumvention_tip: false
process_async_limit: 10
process_async_wait: 1000
process_timeout: 60
tasks:
composer:
no_check_all: false
git_blacklist:
keywords:
- "die"
- "var_dump("
- "exit"
- "console.log("
- "ObjectManager::getInstance"
– “<<<<<<<"
– "======="
triggered_by: ['php', 'phtml', 'js']
phpdoc: ~
phpversion:
project: '7.2'
phplint:
triggered_by: ['php', 'phtml']
ecs:
whitelist_patterns:
- app/code
- app/design
fix: true
xmllint: ~
extensions:
- Wearejust\GrumPHPExtra\Extension\Loader
- NLubisch\GrumPHP\Extension
@milindsingh
Copy link

I have written a detailed ruleset for Magento 2. Hope it helps:
https://adapttive.com/blog/grumphp-in-magento-2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment