Magento 2 : What is Use of @codingStandardsIgnoreFile, @codeCoverageIgnore, @codingStandardsIgnoreStart and @codingStandardsIgnoreEnd

Ezekiel: 20 May 2022

In Any Custom[Module/Extension] development What is use of

  • @codingStandardsIgnoreFile

  • @codeCoverageIgnore

  • @codingStandardsIgnoreStart

  • @codingStandardsIgnoreEnd

It is Valid in Magento Marketplace Extension Development

And It is valid Then Where We can Use For ignore Coding Standard Errors/Warnings


This is used in InstallData, Why it is used here ?

Emilia: 20 May 2022

@codingStandardsIgnoreFile = Ignore the whole file when testing the coding standards.

@codeCoverageIgnore = Ignore the file when testing the code coverage.

@codingStandardsIgnoreStart = Ignore the code below this when testing coding standards.

@codingStandardsIgnoreEnd = Used after @codingStandardsIgnoreStart to begin checking the code again.

As for why it is used there only the developer(s) who build it can say, it's often used to bypass coding standards checks as poor code has been written. I often disagree with even ignoring these tests, what is the point of a test if you are just going to ignore certain files that fail the test.