Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AcquiaDrupalStrict does not sniff install files #1

Closed
swichers opened this issue Aug 4, 2019 · 3 comments
Closed

AcquiaDrupalStrict does not sniff install files #1

swichers opened this issue Aug 4, 2019 · 3 comments
Labels
bug Something isn't working

Comments

@swichers
Copy link

swichers commented Aug 4, 2019

Create a minimal.php file with the following contents:

<?php

function minimal_example() {

}

Run ./vendor/bin/phpcs --standard=AcquiaDrupalStrict minimal.php

Output:

--------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------------------------------
 1 | ERROR | [x] Missing file doc comment
 3 | ERROR | [x] Missing function doc comment
--------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------

Rename minimal.php to minimal.install

Run ./vendor/bin/phpcs --standard=AcquiaDrupalStrict minimal.install

Output:

No output

Run ./vendor/bin/phpcs --standard=Drupal minimal.install

Output:

------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------
 1 | ERROR | [x] Missing file doc comment
 3 | ERROR | [x] Missing function doc comment
------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------

I suspect this issue exists for all non-standard PHP_CodeSniffer file extensions, but I only verified install files.

Having <arg name="extensions" value="inc,install,module,php,profile,test,theme,yml"/> in my own phpcs.xml.dist file does not alter the behavior. Including <rule ref="Drupal" /> prior to <rule ref="AcquiaDrupalStrict" /> does wind up sniffing install files.

@TravisCarden TravisCarden added the bug Something isn't working label Aug 14, 2019
@TravisCarden
Copy link
Contributor

Thanks for this report, @swichers. I don't immediately perceive the cause of this. I'll look into it as soon as I can.

@TravisCarden
Copy link
Contributor

I haven't been able to identify the problem yet. I've reached out for help upstream: squizlabs/PHP_CodeSniffer#2602

@TravisCarden
Copy link
Contributor

TravisCarden commented Sep 6, 2019

I've identified the problem. It seems indeed to be a bug in PHP_CodeSniffer. I've worked around it in 3ea1e57 and released it in v0.4.0. Thanks again for reporting this, @swichers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants