phpro / grumphp

A PHP code-quality tool
MIT License
4.15k stars 431 forks source link

Debugging tasks #388

Closed oojacoboo closed 7 years ago

oojacoboo commented 7 years ago

When running php ./vendor/bin/grumphp git:pre-commit -v I have staged changes that should be failing with phpcs. I've configured my grumphp.yml file with a task for phpcs, but I'm I'm getting that everything is "All good!". That's not the case.

So, my question is, how do I see what paths are being used for tasks being executed? How can I get more details on all of this so I can debug and figure out why a task isn't running.

Secondly, if a task is defined in the config, why would grumphp not be throwing exceptions if it's not running. And, I'm assuming that grumphp would throw an exception if it couldn't find a grumphp.yml file and wouldn't just execute on defaults.

oojacoboo commented 7 years ago

Running grumphp run --config=/path/to/grumphp.yml if the path is incorrect, I do not get an error. This should be throwing an error. I'm also not convinced, even if the path is correct, that it's actually using the config path as it doesn't output any information about the tasks being included.

I was able to get it to work by moving the config to the repo root.

It seems there are a lot of hard coded path assumptions being made :/

veewee commented 7 years ago

Hi @oojacoboo,

It is a known fact that 'exotic' structures cause problems. This is something we do need to tackle before version 1.0, but it is a lot of breaking work. I haven't found the time to look at it yet, even though the issue is open for a long time. The idea is to make all paths relative from the grumphp.yml file. Currently, most paths are relative to the working directory. That is why adding the grumphp.yml file in the root of the project is the easiest.

Besides that, you can get the executed commands by adding the very verbose flag: -vvv. During pre-commit, only the changed files will be validated.

oojacoboo commented 7 years ago

Thanks @veewee. After all of this, we're going to just custom roll our static code analysis tools with git hooks. Thanks for the help. I'll check back on this project after 1.0. I agree that making paths relative to the grumphp.yml file would solve a lot of the issues.

veewee commented 7 years ago

Sad to hear ... Hopefully we'll see you again soon!