You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It simply might not be suitable, but you might have some feedback or ideas for me, hence this ticket.
Given this structure:
/mono
/.git
/projectA (commits in the folder are sent to git@business.com:business/projectA.git by a CI job)
/src
/tests
/composer.json
/grumphp.yml
/projectB
/..
I added "phpro/grumphp" into projectA/composer.json and GrumPHP created projectA/.git and added the hooks in there instead of adding it to mono/.git/. The fix might be to look recursively up the folder tree for .git/ and and use that one instead. However I then realised there were other problems with my setup.
You can set GrumPHP config to look at the right .git/ folder:
# projectA/grumphp.yml
parameters:
# assuming we are working from the mono repo
git_dir: ../.git
Then run GrumPHP from the projectA folder:
cd mono\projectA
./vendor/bin/grumphp run
The issue is that it appears to prefix CWD to the files it finds with ls-files. Also, ls-files is returning all files from all project folders. It then passes to the Task, e.g. phpmd, which then complains the files cannot be found:
# projectA files:
Path /mono/projectA/projectA/src/Business/ProjectA/MyClass.php does not exist
# projectB files:
Path /mono/projectA/projectB/src/Business/ProjectB/MyClass.php does not exist
I could look into a solution for this, but I did wonder, what should I expect my commit includes changes in projectB? I wasn't sure of the answer given it might have it's own projectB/grumphp.yml... One could have a warning "only checking files descending from grumphp.yml"
So to summarise:
Possible ascend up and look for .git folder on initialisation;
Prevent CWD prefix issue;
Possible feature (config setting?) to whitelist files that descend from grumphp.yml;
The text was updated successfully, but these errors were encountered:
Part of my issues appears to be due to git_dir parameter being the folder where the .git folder is found as opposed to the actual .git folder. Removing .git helped a bit.
In the future it'd be good if git_dir meant the "git directory" :)
Thanks for GrumPHP!
I'm setting up for the first time and I just wanted to get some feedback on GrumPHP and applicability with the mono -> many repo structure enabled by https://github.com/splitsh/lite and https://github.com/jderusse/docker-gitsplit
It simply might not be suitable, but you might have some feedback or ideas for me, hence this ticket.
Given this structure:
I added
"phpro/grumphp"
intoprojectA/composer.json
and GrumPHP createdprojectA/.git
and added the hooks in there instead of adding it tomono/.git/
. The fix might be to look recursively up the folder tree for.git/
and and use that one instead. However I then realised there were other problems with my setup.You can set GrumPHP config to look at the right
.git/
folder:Then run GrumPHP from the
projectA
folder:The issue is that it appears to prefix CWD to the files it finds with
ls-files
. Also,ls-files
is returning all files from all project folders. It then passes to the Task, e.g.phpmd
, which then complains the files cannot be found:I could look into a solution for this, but I did wonder, what should I expect my commit includes changes in
projectB
? I wasn't sure of the answer given it might have it's ownprojectB/grumphp.yml
... One could have a warning "only checking files descending from grumphp.yml"So to summarise:
.git
folder on initialisation;grumphp.yml
;The text was updated successfully, but these errors were encountered: