In order to submit extensions to Magento marketplace, source code needs to pass Magento Extension Quality Program Coding Standard checks.
You can either do it manually, by following this guide in official Github repository, or by fixing things as you code, by setting up check in PHP Storm.
- Install the phpcs to your system by executing:
# pear install PHP_CodeSniffer
- Git clone the repo with official standards:
$ git clone [email protected]:magento/marketplace-eqp.git
- Locate where phpcs sotres standards and copy them from the repo above. On Ubuntu based systems, they are located in /usr/share/php/PHP/CodeSniffer/Standards. You have to copy MEQP1, MEQP2 and Utils folders there:
# cp -R marketplace-eqp/MEQP1 /usr/share/php/PHP/CodeSniffer/Standards/
# cp -R marketplace-eqp/MEQP2 /usr/share/php/PHP/CodeSniffer/Standards/
# cp -R marketplace-eqp/Utils /usr/share/php/PHP/CodeSniffer/Standards/
- Make sure you have configured PHP interprter. You can do so by going to
Languages & Frameworks > PHP
- Make sure you have confiugred PHP Code Sniffer. You can do so by going to
Languages & Frameworks > PHP > Code Sniffer
- Enable code sniffer and choose validation standard:
Editor > Inspections > PHP
-
Find PHP Code Sniffer Validations and tick the box next to it, in order to turn it on
-
On the right pane, select MEQP1 for Magento 1 validation, or MEQP2 for Magento 2 validation
@michielgerritsen, good catch.
I added via composer require magento/marketplace-eqp --dev in the project
In Languages & Frameworks | PHP | Quality Tools | Code Sniffer, I set the path vendor/bin/phpcs and worked without errors.