Skip to content

Improve pre-push hook output visibility for RuboCop failures #44

@johnburbridge

Description

@johnburbridge

Problem

The pre-push hook runs checks in this order:

  1. RuboCop (fast, small output)
  2. RSpec (slow, verbose output - 617 tests with warnings)
  3. Gem build (fast, small output)

When RuboCop fails, the failure message gets buried in 38,000+ characters of RSpec output, making it invisible to developers.

Evidence from SPI-1301

When pushing PR #41, we saw:

✓ RSpec passed (all tests passing)
✓ Gem built successfully
...
Some pre-push checks failed! ✗

But couldn't see which check failed. The RuboCop failure was in the truncated section (38,000+ chars of RSpec warnings). We used --no-verify to bypass, and CI caught it later.

Proposed Solution

Reorder checks to fail-fast:

  1. RuboCop first (fast, small output) - failures are immediately visible
  2. Gem build second (fast, validates gemspec)
  3. RSpec last (slow, verbose, but most likely to pass)

Benefits:

  • RuboCop failures appear at the top of output (always visible)
  • Developers get immediate feedback without scrolling
  • Faster feedback loop (RuboCop takes ~5 seconds vs RSpec ~10 seconds)
  • Matches CI order (RuboCop → RSpec → Build)

Alternative Solutions

Option A: Suppress RSpec warnings in pre-push hook

bundle exec rspec --tag ~e2e --format progress 2>/dev/null

Pros: Smaller output, Con: Hides potentially useful warnings

Option B: Run only RuboCop + gem build pre-push, let CI run full tests
Pros: Fast feedback, Con: Slower feedback loop for test failures

Option C: Add summary at the end showing which checks failed
Pros: Always visible, Con: Still requires scrolling to see details

Recommendation

Option: Reorder to RuboCop → Gem → RSpec (proposed solution above)

Simple, effective, no information loss.

Related

Files to Change

  • .githooks/pre-push (lines 60-113)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions