I don't work in the Marketplace team, but my understanding is they have been iteratively increasing tests performed on marketplace, then going back to extension developers to have them address the issues. This particular issue sounds similar to a recent issue that had a bulk mail out to extension developers. (I have not checked your specific case, but it looks similar.) We are already working with a list of extension developers to address the issue (which does not help you in the short term). The cases I know of the extension needs adjustment - its not your fault.
Another similar case is we were allowing extensions to pick the subset of PHP versions it supports. This however also causes problems as different extensions may only support different versions of PHP - so we are clarifying the policy (and adding checks) so that "you must support all versions of PHP that Magento officially supports for that version of Magento (2.0 and 2.1 support different versions of PHP).
There are more checks coming along as well which are being retrospectively applied, then failing extension developers are being informed of the issues to be corrected. E.g. Varnish support is another one. Some issues however area easier than others to detect reliably.
I have not checked what you did closely, but I think completely reasonable to pass these instructions on to the extension developer. I will pass this issue on to the Marketplace team as well to see if this extension is already being talked to on the same issue.
Or (rereading) did I misunderstand and you are saying you are submitting to the marketplace and getting the error, but don't understand the cause? In which case I have not responded to your question at all! It is mandatory for extensions to work in production mode. That is not a marketplace problem - that is a problem with an error in your code not being visible until you turn on production mode.
If you are running out of memory locally, you may need to increase your memory limit in the php.ini file in scope. If Marketplace is failing during the submissions process, it may be we need to upgrade the limit internally on our test script. Composer is unfortunately quite memory hungry at times as well.
So sorry if I am not quite following, but on second reading I would say it is insufficient memory being allocated (controlled by the php.ini file). You need to adjust this on your site - have a look at http://devdocs.magento.com/guides/v2.0/install-gde/system-requirements-tech.html For more details on memory limits etc.
Below are the few things I found which can help to reduce rejection and pass EQP process.
Module Checks:
- Keep Your vendor name same as Vendor Name of your Marketplace account
- Create your extension with
developer
mode enabled
- Must have composer.json in root folder of extension Eg. app/code/Vendor/Module/composer.json" with correct configurations and dependencies
- Must have registration.php in root folder of extension Eg. app/code/Vendor/Module/registration.php"
Code Checks:
Do not use $_REQUEST
, $_POST
, $_GET
, $_FILE
directly
Never end class file with ending php tag ?>
Do not use die()
or exit()
in your code.
Do not use // @codingStandardsIgnoreLine
or // @codingStandardsIgnoreFile
in code
Remove unnecessary code and comments
Use spaces for indentation
Check for code duplication Refer Use ClassPreferences
and/or Magento 2's plugin
structure to avoid duplicating code.
Add PHP DockBlock for your classes
Use proper DockBlock for each of your functions with parameters and return types.
It is better to use Service Contract approach for your module development.
Testing and Debugging:
- Check extension functionality with Magento compilation
php bin/magento setup:di:compile
- Check compatibility with
production
mode enabled
- Test with cache enabled and disabled
- Validate your package e.g.
php validate_m2_package.php my-theme.zip my-module.zip
- Check coding standard with
phpcs
E.g. $ vendor/bin/phpcs /path/to/your/extension --standard=MEQP2 --severity=10
- Do Complete Testing of your code. Execute command
bin/magento dev:tests:run
More Reference
Content and Description Checks:
- Do not use Magento logo in your documents or images
- Do not use "Product Box Image" as extension main image
- Add proper description for your extension functionality
- Correct grammatical errors (punctuation, capitalization, word usage, etc). Remember to use "a","an", and "the" correctly. Make sure words are plural when necessary. Be sure words that should be past tense are past tense.
- Check and confirm you do not have any broken link in your document or description content.
- Do not add links of other extensions/services in description content. Promoting services or other created extensions in Magento Marketplace or Magento Connect is prohibited.
Other:
- Submit an e-copy of your Tax Forms to marketplace@magento.com (Required only if you are selling paid extensions)
Keeping the practice of following above standards will surely improve extension quality.
Best Answer
After an hour going through the report I came up with the following list, it could be helpful for everyone I think.
I will try to keep it updated as soon as I find more warnings/errors:
Warnings
Or
Those one are the one I've seen the most, they are self explanatory, it is a good practice to keep coding lines small in order to keep a clean and readable code.
You have called a function that receives parameters and didn't add a space after the comma. Example:
strrchr($bla,".")
should bestrrchr($bla, ".")
That means you have returned a line before the opening bracket of those PHP statements.
Example of a bad syntax with an if/else statement:
Should be
Most of the time, it happens in the constructor where you declare something like this:
Whereas it should be:
Happens most of the time at the beginning of the file, it's caused by the way your IDE encodes the return character.
Every variable must use the camel caps format, so
$your_variable
should be$yourVariable
Avoid using numbers in your variables
You should not be using inline control structures such as:
You should use:
You have returned a line when declaring a class:
You should keep the opening brace on the same line:
You should add a leading underscore to your protected and private member variables:
$_yourVariable
As opposite of those two, if you add an underscore in your public variable you can get:
You have passed a parameter to a method but you never use it.
You have added too much indentation to your function declaration parameters:
Should be:
You're overriding a method without adding modifications, example:
You're using the
load()
method inside a loop which in not recommended and has to be avoided.Most likely your code looks like this:
If you're loading a model in a loop it's indeed pretty bad in terms of performance. If you only need to retrieve a few attributes, you should use collections instead.
If you're not familiar with cyclomatic complexity I suggest you have a read at this post: https://pdepend.org/documentation/software-metrics/cyclomatic-complexity.html . This warning basically means that there is too many loops and conditions in your function.
It is caused by the fact that you're instantiating an object directly by calling the class, for example:
You should use dependency injection or a last resort, the object manager.
One of your comment contains the following
@TODO
flag.You have create a condition that seems to always be true or false.
For example:
Errors
You are missing the
use Path\To\Class;
statement at the beginning of your class.