vscode-phpcs icon indicating copy to clipboard operation
vscode-phpcs copied to clipboard

Lint only opened PHP files?

Open sofyansitorus opened this issue 6 years ago • 10 comments

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 avatar May 25 '18 23:05 sofyansitorus

@sofyansitorus strange that does not happen to me.

Below is an example where there are 4 files. 2 of them have errors.

example-1

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

example-2

tfirdaus avatar May 28 '18 03:05 tfirdaus

@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! 👍

sofyansitorus avatar May 28 '18 05:05 sofyansitorus

@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?

IMG

sofyansitorus avatar May 29 '18 08:05 sofyansitorus

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. :-(

joeworkman avatar Jun 04 '18 04:06 joeworkman

+1 Adding options to only enable linting while the files is opened

sofyansitorus avatar Jun 04 '18 08:06 sofyansitorus

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.

jaredatch avatar Jun 06 '18 15:06 jaredatch

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 avatar Jul 03 '18 18:07 cyann

@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 avatar Jul 03 '18 18:07 jaredatch

@jaredatch

Yes, this is the default. I've also copied that my workspace and user settings, no changes.

cyann avatar Jul 03 '18 18:07 cyann

+1 for this feature, I believe this feature solves the bug that causes multiple PHP process spawning that floods CPU to 100% usage.

arvilmena avatar Jan 14 '19 02:01 arvilmena