Skip to content

Gate integration - pre-commit quality checks #4

@jordanpartridge

Description

@jordanpartridge

Overview

Integrate with gate CLI for pre-commit quality validation.

Commands

commit check

commit check                    # Run gate checks on staged files
commit check --quick           # Fast checks only (lint, format)
commit check --fix             # Auto-fix issues

commit --gate

commit -a -m "feat: X" --gate  # Run gate before commit

Integration Flow

1. Stage files
2. commit check (optional but recommended)
3. Gate runs: pint, phpstan, tests on affected files
4. Pass? → Commit
5. Fail? → Show errors, block commit

Configuration

# .commit.json or composer.json
{
    "commit": {
        "gate": {
            "enabled": true,
            "quick-only": false,
            "auto-fix": true
        }
    }
}

Gate Integration

// Call gate CLI
$result = Process::run('gate check --files=' . implode(',', $stagedFiles));

if ($result->failed()) {
    $this->error('Gate checks failed. Fix issues before committing.');
    return self::FAILURE;
}

Pre-commit Hook (Optional)

commit hook install            # Install git pre-commit hook
commit hook remove             # Remove hook

Hook calls commit check automatically.

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