Skip to content

Conversation

Copy link

Copilot AI commented Nov 1, 2025

Addressed code review feedback on the DDEV auto-detection feature for preflight checks.

Changes

  • Extracted helper functions to eliminate duplication between DDEV and non-DDEV execution paths:

    • run_pint() - Executes Pint with optional command prefix
    • run_phpstan() - Executes PHPStan with optional command prefix
    • run_tests() - Executes tests (Artisan/Pest/PHPUnit) with optional command prefix
    • Each accepts cmd_prefix parameter: empty string for host execution, "ddev exec" for containerized execution
  • Changed Pint flag from --test to --dirty per Laravel guidelines to auto-fix formatting issues instead of validation-only

Before/After

# Before: Duplicated logic
if [ "$USE_DDEV" = true ]; then
  if [ -x ./vendor/bin/pint ]; then
    ddev exec ./vendor/bin/pint --test
  fi
else
  if [ -x ./vendor/bin/pint ]; then
    ./vendor/bin/pint --test
  fi
fi

# After: Single function, reusable
run_pint() {
  local cmd_prefix="$1"
  if [ -x ./vendor/bin/pint ]; then
    ${cmd_prefix} ./vendor/bin/pint --dirty
  fi
}
run_pint "ddev exec"  # or run_pint ""

Impact

  • Reduces ~40 lines of duplicated code
  • Single source of truth for each tool's execution logic
  • Pint now auto-fixes formatting issues in pre-push hooks

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Co-authored-by: kevalyq <237265092+kevalyq@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix auto-detect DDEV for preflight checks refactor: extract helper functions and use --dirty flag for Pint Nov 1, 2025
Copilot AI requested a review from kevalyq November 1, 2025 19:28
Copilot finished work on behalf of kevalyq November 1, 2025 19:28
@kevalyq kevalyq closed this Nov 1, 2025
@kevalyq kevalyq deleted the copilot/sub-pr-57 branch November 10, 2025 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants