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

PHPCS doesn't check files that begin with a dot #1928

Closed
w0rp opened this issue Mar 10, 2018 · 3 comments
Closed

PHPCS doesn't check files that begin with a dot #1928

w0rp opened this issue Mar 10, 2018 · 3 comments

Comments

@w0rp
Copy link

w0rp commented Mar 10, 2018

This bug was originally raised in ALE here: dense-analysis/ale#1408

I installed PHP_CodeSniffer 3.23 and created a simple file.

<?php
$x = 1
?>

If you name the file foo.php, and run phpcbf -q --stdin-path=foo.php - < foo.php, then phpcbf returns the contents of the file. If you rename the file to .foo.php and run phpcbf -q --stdin-path=.foo.php - < .foo.php, then phpcbf returns the following.

No fixable errors were found

Time: 25ms; Memory: 4Mb

ALE wants to be able to pipe the buffer data into the program and read the fixed results from stdout, so this causes some issues where buffers are replaced with the above output.

@gsherwood
Copy link
Member

Note that this isn't an issue with PHPCBF. PHPCS itself will not check a hidden file, so it doesn't produce any error messages for PHPCBF to fix. The same thing would happen if you didn't specify an extension on the stdin-path.

Having PHPCS start checking hidden files, and/or those without an extension would be a fairly big change.

@gsherwood gsherwood changed the title phpcbf --stdin-path is broken when the filename starts with a dot PHPCS doesn't check files that begin with a dot Mar 12, 2018
@w0rp
Copy link
Author

w0rp commented Mar 12, 2018

I didn't know that hidden files were special. I'll make ALE skip checking any files which start with a dot for now.

@gsherwood
Copy link
Member

Closing as I've had not further interest in making a core change like this, and it couldn't be made until a major release anyway. If more interest comes up, I'll revisit for version 4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants