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

skip directories not patterns #1113

Closed
wstaples opened this issue Aug 10, 2016 · 2 comments
Closed

skip directories not patterns #1113

wstaples opened this issue Aug 10, 2016 · 2 comments

Comments

@wstaples
Copy link

Is it possible to skip an entire directory without traversing it for a pattern? For example
a typical laravel tree looks like:

.  
├── app  
├── bootstrap  
├── config  
├── database  
├── public  
├── resources  
├── storage  
├── tests  
└── vendor  

in my phpcs.xml file I have:

<file>.</file>
<exclude-pattern>./vendor/*</exclude-pattern>

when I run phpcs the run time is about 1 minute. If I painstakingly add all of the directories like this:

<file>./app</file>
<file>./bootstrap</file>
<file>./config</file>
<file>./database</file>
<file>./public</file>
<file>./resources</file>
<file>./storage</file>
<file>./tests</file>

then the run time of phpcs is about 1 second.

If I use the -v option I can see that in both cases it will say Creating file list... DONE (55 files in queue) however using the exclude-pattern it gets stuck at Creating file list forever. Which is why I believe it is still traversing the vendor directory even though it is ignored. I have tried a few variations on the pattern (vendor, vendor/*, ./vendor/*) I also tried using the type="relative" attribute as well. I also tried using --ignore

I'm on an Ubuntu 14.04 64-bit box with PHP_CodeSniffer version 2.6.2 (stable) by Squiz (http://www.squiz.net).

@gsherwood
Copy link
Member

You can't do this in the 2.x versions, but that optimisation has been made during the refactoring of the 3.x version. The 3.x version was specifically designed to make these sort of improvements easier to make.

If you download and try 3.0.0a1, that exclude pattern will exclude the vendor dir and not check anything else under it. But the code between the two versions is very different, so these sort of improvements have not been backported.

The workaround you'v got now is, unfortunately, the only way to speed it up.

Does that explain things?

@gsherwood
Copy link
Member

Closing as I assume the explanation was ok given no feedback. If not, please comment again.

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

No branches or pull requests

3 participants