Has anyone got a cheat sheet style list of the common Magento 2 code quality exclusions?

// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis
// phpcs:disable Magento2.Files.LineLength.MaxExceeded

etc

I've search online but I can't find anything

有帮助吗?

解决方案

Put together something myself

// phpcs:ignoreFile
$stuff = [1,2,3]; // phpcs:ignore
// phpcs:disable Generic,Squiz,Magento2
// phpcs:disable Magento2.Exceptions
// phpcs:disable
$stuff = [1,2,3];
// phpcs:enable
// phpcs:disable Generic.Metrics.NestingLevel
// phpcs:disable Generic.CodeAnalysis.UselessOverridingMethod
// phpcs:disable Generic.WhiteSpace.ScopeIndent
// phpcs:disable Magento2.Classes.AbstractApi
// phpcs:disable Magento2.CodeAnalysis.EmptyBlock
// phpcs:disable Magento2.Exceptions.ThrowCatch
// phpcs:disable Magento2.Exceptions.DirectThrow
// phpcs:disable Magento2.Functions.DiscouragedFunction
// phpcs:disable Magento2.PHP.ShortEchoSyntax.ShortEchoTag
// phpcs:disable Magento2.Security.IncludeFile
// phpcs:disable Magento2.Security.InsecureFunction
// phpcs:disable Magento2.Templates.ThisInTemplate
// phpcs:disable Squiz.Commenting.ClassComment.Missing
// phpcs:disable Squiz.Functions.GlobalFunction
// phpcs:disable Squiz.PHP.GlobalKeyword.NotAllowed
// phpcs:disable Squiz.WhiteSpace.ScopeClosingBrace.ContentBefore
许可以下: CC-BY-SA归因
scroll top