phpro / grumphp

A PHP code-quality tool
MIT License
4.11k stars 429 forks source link

PHPCS not running on grumphp #1063

Closed prafullazee closed 1 year ago

prafullazee commented 1 year ago
Q A
Version 1.15.0
Bug? maybe
New feature? no
Question? yes
Documentation? no

phpcs: standard: ["PSR12", "PSR2", "PSR1", "PEAR"] ignore_patterns: [./tests/, ./resources/, ./database/, ./bootstrap/, ./storage/*] whitelist_patterns:

Steps to reproduce:

Run GrumPHP:

./vendor/bin/grumphp run


**Result:**

Running task 1/15: file_size... ✔ Running task 2/15: composer... Running task 3/15: git_branch_name... ✔ Running task 4/15: phpversion... ✔ Running task 5/15: phpcs... Running task 6/15: phpcpd... ✔ Running task 7/15: phpstan... ✔ Running task 8/15: phplint... ✔ Running task 9/15: phpcsfixer2... ✔ Running task 10/15: phpspec... ✔ Running task 11/15: phpparser... ✔ Running task 12/15: phpmd... Running task 13/15: phpmnd... Running task 14/15: jsonlint... Running task 15/15: stylelint...

rajuguptahipi commented 1 year ago

When running the grumphp pre commit hook (./vendor/bin/grumphp:git:pre-commit), it fails to check for phpcs problems in php Laravel project. View the outcome above, The error isn't being validated by phpcs.

OS : Windows Editor: VScode

veewee commented 1 year ago

@rajuguptahipi phpcs only runs on the changed files. If no files are left after applying the ignore patterns, it will not run at all during that pre-commit. Can you make sure that is not the case here?

Since the list of files can be rather long, we pass the files through a temporary file. Maybe that is where it goes wrong? See

prafullazee commented 1 year ago

@veewee in my case, files are newly created and added to stage, still having the issue and if you have noticed phpcs, phpmd, phpmnd etc are not running and all others are running.

veewee commented 1 year ago

Well hard to tell from my side what is going wrong exactly on your setup with the information given. There are some things you can do to debug:

veewee commented 1 year ago

Closing this one because of inactivity If the issue still persists - feel free to reopen and provide some additional context.