vscode-phpcs
vscode-phpcs copied to clipboard
Lint only opened PHP files?
CMIIW, for now I see this extension will lint all PHP files under the folder project. It will be useful saving resources if this plugin can lint only opened files.
@sofyansitorus strange that does not happen to me.
Below is an example where there are 4 files. 2 of them have errors.

...the error report seems following the file when it's closed or opened.

@tfirdaus Yeah it seems mine also work as yours. It seems I was confused by another linter report that printed in the PROBLEMS tab 🤦♂️ . Thanks for clarifying! 👍
@tfirdaus Today I got the same issue happen again. The PHP files has been closed but the linting still run as we can see it at the status bar at the bottom, and the report tabs is still has list of PHP files that never opened before. Have you ever face this issue before?
phpcs definitely processes all files in the project folder. Not just open files. I have a very large repository that has a lot of legacy PHP code that I need in my repo but dont need to worry about phpcs on them at this time. I would love to disable this. I have 920 phpcs errors at this time in my status bar. :-(
+1 Adding options to only enable linting while the files is opened
Oh man, I can't +1 this enough. I'd donate some dough for this feature.
I use PHPCS on VSC daily. For the most part it works well. But one of the projects I work on regularly is really large and the PHPCS package is more or less unusable. It takes forever to lint the project and basically ends up just linting itself into oblivion due to the size of things.
An option to only lint OPEN files and only lint on save (not on type) would completely solve all my issues.
PHPCS is also linting files in the Source Control tab, and I can't remove them from the Problems view.
I've added this to my config, but that doesn't work:
"phpcs.ignorePatterns": ["git:/*"],
@cyann
In your user or workspace settings, you should have something like:
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true
},
That should seems to prevent the issue for me (at least, that I can tell).
@jaredatch
Yes, this is the default. I've also copied that my workspace and user settings, no changes.
+1 for this feature, I believe this feature solves the bug that causes multiple PHP process spawning that floods CPU to 100% usage.