Closed wagnerferreirasp closed 7 years ago
GrumPHP's job is to check changed files on commit. If you want to check all files you just provided the command to do this. The point being, you either need to check all files manually, or automatically but using some trigger other than the commit hook (e.g. your CI process). Recommend closing as invalid.
Maybe I was wrong and the issue could be about a new feature. It makes sense that GrumPHP checks changed files only and this apply to many tasks, like copy-paste detector, git_blacklist, phpcs. However, for phpstan, a change in a committed file may affect others and cause a bug we don't want to commit.
The phpstan task inside GrumPHP let me do a lot of things that I do via phpstan's command line, but "run for all files" is not one of them.
I already managed to get it work with GrumPHP, using a composer script that runs phpstan for all files. Now, any change that causes the code to fail at phpstan, GrumPHP won't let me commit and that is great.
Would be nice to have on the phpstan task configuration the list of directories to run, or let me choose for the default (run for changed files).
Thanks anyway!
@wagnerferreirasp,
Thanks for reporting. Currently this is indeed not possible. Since the phpstan task is rather new, I created a ticket to improve the phpstan task (#400). We'll continue the discussion from there.
My configuration
Steps to reproduce:
Your actions
Run GrumpHP:
Result: The run shows erros for files that were not changed, but uses the method of class A that changed. However, the commit was "All good", probably because the commited file has no errors, but the other were affected by the change of class A.