dpc-sdp / dev-tools

Tools used for development of Tide distribution and modules.
2 stars 1 forks source link

Removed the exclusion of docroot from phpcs. #26

Open sonnykt opened 5 years ago

sonnykt commented 5 years ago

Currently ahoy lint and PHPCS do not check any code in docroot/modules/custom due to the exclusion in phpcs.xml. We need to remove this exclusion so that CI can check for coding standard in custom modules.

On-behalf-of: @salsadigitalauorg sonny@salsadigital.com.au

anthony-malkoun commented 5 years ago

Also, does composer.json need updating?

christopher-hopper commented 3 years ago

I'm also encountering this problem. I noticed custom code I am reviewing is passing tests, even though it violates Drupal coding standards. Digging into why, I found this phpcs.xml is excluding everything.

Could this phpcs.xml could be brought up-to-date with a more flexible, and inclusive structure. A default could be to scan everything in

    <!-- Include these files -->
    <file>docroot/sites/default</file>
    <file>docroot/modules/custom</file>
    <file>docroot/themes/custom</file>
    <file>tests</file>

Rather than excluding lots and lots of things, a smaller inclusions list could help project teams who use SDP. It would work better with IDEs, and either compliment, or negate the need for, a PHPCS_TARGETS env var.

Also, if we renamed it to phpcs.xml.dist we could allow local overrides for individuals. Similar to how phpunit.xml.dist works.