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

Excluding files doesn't work when using STDIN with a filename specified #1208

Closed
rkit opened this issue Nov 7, 2016 · 4 comments
Closed

Comments

@rkit
Copy link

rkit commented Nov 7, 2016

Excluding files doesn't work when using stdin

Config:

<?xml version="1.0"?>
<ruleset name="Custom Standard">
    <description>A custom coding standard</description>

    <exclude-pattern>*/views/*</exclude-pattern>
    <rule ref="PSR2" />
</ruleset>

Command:

cat /test/views/index.php | phpcs --standard="/test/phpcs.xml" --stdin-path="/test/views/index.php"

And as a result, we got errors.

Is it a known bug? I would like to fix it

PHP_CodeSniffer version 2.7.0 (stable) by Squiz (http://www.squiz.net)
@gsherwood
Copy link
Member

PHPCS has always assumed that if you are passing content directly to it, you want it checked no matter what the exclude rules are. I have changed this in 3.0 (due to request #733), but it is a serious backwards compatibility break so it wont be changed in the 2.x version.

If you'd like to try out the current 3.0 RC release, you should find that it works as you expect.

@rkit
Copy link
Author

rkit commented Nov 11, 2016

due to request #733

I use this linter for the Atom

If you'd like to try out the current 3.0 RC release, you should find that it works as you expect.

I tried with 3.0.0RC1 and the result is the same, I have got errors.

PHP_CodeSniffer version 3.0.0RC1 (beta) by Squiz (http://www.squiz.net)

@gsherwood gsherwood changed the title Excluding files doesn't work when using stdin Excluding files doesn't work when using STDIN with a filename specified Nov 13, 2016
gsherwood added a commit that referenced this issue Nov 13, 2016
@gsherwood
Copy link
Member

I tried with 3.0.0RC1 and the result is the same, I have got errors.

Sorry, it was working and I've realised it broke when the stdin-path feature was merged in from master. I've fixed it again now.

@rkit
Copy link
Author

rkit commented Nov 14, 2016

Thanks!

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