Skip to content

Pre-push hook error message unclear when PR exceeds 600-line limit #80

@kevalyq

Description

@kevalyq

Problem

When attempting to push changes that exceed the 600-line PR size limit, the pre-push hook fails with an unclear error message:

error: failed to push some refs to 'github.com:SecPal/api.git'

This generic error doesn't explain why the push failed or what to do about it.

Expected Behavior

The error should clearly indicate the size violation:

❌ Pre-push check failed: PR too large

Your changes contain 644 lines (636 insertions, 8 deletions).
Maximum allowed: 600 lines per PR.

Please split your changes into smaller, focused PRs.

Tip: Use --no-verify to bypass this check if necessary.

Actual Behavior

$ git push origin feat/password-reset-email
remote: Enumerating objects: 31, done.
remote: Counting objects: 100% (31/31), done.
remote: Compressing objects: 100% (20/20), done.
remote: Total 25 (delta 13), reused 0 (delta 0), pack-reused 0
error: failed to push some refs to 'github.com:SecPal/api.git'

Context

Root Cause

The preflight.sh script likely has a generic error handler that doesn't provide specific messages for different failure scenarios (test failures vs size violations vs linting errors).

Acceptance Criteria

  1. When PR exceeds 600 lines, error message must:

    • State the exact line count (insertions + deletions)
    • Show the 600-line limit
    • Suggest splitting the PR
    • Mention --no-verify bypass option
  2. Error should be distinguishable from other pre-push failures (tests, linting, etc.)

  3. Consider color-coding: red for error, yellow for warning, blue for info

Related

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions