extdn / extdn-phpcs

PHP CodeSniffer rules
81 stars 10 forks source link

Rule: Modules should not use cacheable="false" #29

Open larsroettig opened 6 years ago

larsroettig commented 6 years ago

Doc: https://devdocs.magento.com/guides/v2.3/extension-dev-guide/cache/page-caching.html

Do not configure content pages (i.e., catalog, product, and CMS pages) to be uncacheable. Doing so has an adverse affect on performance.

schmengler commented 6 years ago

Since it's hard to determine if a block is used on a content page eventually, a warning about any cachable=false occurence makes sense, given the potential impact.

tdgroot commented 6 years ago

One of the steps in our bitbucket-pipelines.yml is:

- echo ! grep -r --include=*.xml --exclude=checkout_*.xml 'cacheable=\"false\"' app/ | sh

This command will give error when it finds a cachable="false" in any xml file.

Anyway, it would be great if this check gets added to the suite. @schmengler does this suite parse xml files as well?