2

I want to check My Extension's coding standard for Magento Marketplace before submitting it on **Magento Marketplace*. Can anyone tell me how can I install coding standard in My Local Environment and check my extension whether this extension is eligible or not for Magento Marketplace code standard.

Thanks In Advance..!

2

Magento use EQP Coding Standard tool for checking the coding standard of a module.https://github.com/magento/marketplace-eqp

Magento this tool used basically using PHP_CodeSniffer tool.

If you want to in run EQP Coding Standard on your local system, then follow steps:

  1. Go to your Magento root directory, install this too using composer:

composer create-project --repository=https://repo.magento.com magento/marketplace-eqp magento-coding-standard

  1. Then go to this tool directly using cd magento-coding-standard

  2. run Composer update command composer install which will update module dependency packages. Also set config path specific PHP version set paths to php binary dir

vendor/bin/phpcs --config-set php7.0_path /path/to/your/php7

  1. After that, you can use below command for checkout code start of your module from magento-coding-standard folder

    php vendor/bin/phpcs /path/to/your/extension --standard=MEQP2

use MEQP2 for magento2 extension.

Example:

php vendor/bin/phpcs /var/www/html/MagentoProkect/app/code/DevAmitbera/CustomModule --standard=MEQP2 --extensions=php,phtml

Here i give full path of my extension /var/www/html/MagentoProkect/app/code/DevAmitbera/CustomModule

4.1. If you use windows and face some path must be translated related warning in command line then try below solution. Install Cygwin console from https://cygwin.com and then go to magento-coding-standard directory and run below command.

vendor/bin/phpcs F:/xampp/htdocs/magento2/app/code/DevAmitbera/CustomModule --standard=MEQP2 --severity=10 --extensions=php,phtml

  1. After That, I have tun code sniffer auto fixer command which is basic code standards issue.

php vendor/bin/phpcbf /path/to/your/extension -extensions=php,phtml --standard=MEQP2

Example:

php vendor/bin/phpcbf /var/www/html/app/code/DevAmitbera/CustomModule --standard=MEQP2 --extensions=php,phtml

After re-run Step 4 command for check out the rest of error which you need to fix yourself manually.

  • I will try and let you know, If My extension is pass in this than it will approved in Magento Marketplace ? – Sanjay Gohil Apr 16 at 9:00
  • 1
    You have to follow also https://docs.magento.com/marketplace/user_guide/Resources/pdf/Extension_Quality_Program_Overview.pdf and – Amit Bera Apr 16 at 9:03
  • I got this error : PHP Fatal error: Interface 'PHP_CodeSniffer_Sniff' not found in vendor/magento-ecg/coding-standard/EcgM2/Sniffs/Plugins/PluginSniff.php on line 7 – Sanjay Gohil Apr 16 at 9:16
  • run composer install command on magento-coding-standard folder – Amit Bera Apr 16 at 9:17
  • prntscr.com/nclrtq – Sanjay Gohil Apr 16 at 9:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.