JakubOnderka / PHP-Parallel-Lint

This tool check syntax of PHP files faster than serial check with fancier output.
Other
647 stars 62 forks source link

Check only changed files #103

Open VincentChataignier opened 6 years ago

VincentChataignier commented 6 years ago

Hello,

I think we could add the option --only-git-changed. This option will force an analysis only on the changed files.

This is just an idea. I don't know if this feature is possible for PHP-Parallel-Lint. Library https://github.com/M6Web/Coke does this feature.

Thanks, Best regards,

Vincent Chataignier

VincentChataignier commented 6 years ago

For the moment I use $(git --no-pager diff --name-only --diff-filter=MARC| grep -E 'src/|tests/') to list changed files. I use this git command instead of paths and that's working.

vendor/bin/phpstan analyse -c phpstan.neon -l 1 $$(git --no-pager diff --name-only --diff-filter=MARC| grep -E 'src/|tests/')

grogy commented 6 years ago

Hello,

thanks for you issue. My question is about application this idea. What benefit it has? Or what is your reason for this change? Parallel-lint is very fast :-)

Thanks

VincentChataignier commented 6 years ago

Run PHP-Parallel-Lint only in changed file improve the rapidity in huge project. For example, we have approximately 3700 files to lint, that's working in approximately 150 seconds.

Use cases for --only-git-changed are for developers who want to check code before commit and push in the CI (Travis, Jenkins ...). That's improve the waiting time during development.

For the moment, we use $(git --no-pager diff --name-only --diff-filter=MARC) but I think this functionality should be added in library to benefit everyone :smiley:

grogy commented 6 years ago

Okay, I understand to your reasons and it make sense for me.

Can you add PR with test? What do you mean? :-)

VincentChataignier commented 6 years ago

I added a new commit about this issue. Can you check it please :smiley: before my PR? I saw the similar issue #75 and my code is inspired by this one.