Skip to content

Make Code Quality aware of DDEV #393

Open
@hkirsman

Description

@hkirsman

If you install DDEV to this project and try to commit, Code Quality tool (GrumPHP) will start Lando instead because we have this in code:

  git_hook_variables:
    EXEC_GRUMPHP_COMMAND: lando php

Either we keep this as is as Lando can handle starting up only the the needed containers on demand, or we add some logic to decide what to run.

Unfortunately we're quite limited on writing some advanced code here but I've come up with this logic:

  1. We assume our projects can have both Lando and DDEV setups for now.
  2. We assume developer uses either Lando or DDEV, but not both. So this means every developer has the project set up with either Lando or DDEV only.
  3. So based on these assumptions, DDEV creates different folders under .ddev if it has been started. These are not there if you clone the project. So the trick is to check if .ddev/traefik/ folder exists and if so then start Code Quality with DDEV, if not then with Lando.
grumphp:
  git_hook_variables:
    EXEC_GRUMPHP_COMMAND:  "[ -d .ddev/traefik/ ] && GRUMPHP_COMMAND='ddev php' || GRUMPHP_COMMAND='lando php' && $GRUMPHP_COMMAND"

On existing projects this needs to be run:
ddev grumphp git:init

Wondering also if I should instead create some automatic update to wunderio/ddev-drupal package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions