whitesmith / whitesmith/rubycritic

Suggestion: `git stash` before comparing branches?

Open
#387 7 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
3.5k
Forks
234
PR merge metrics
No merged PRs in 30d

Description

Hi; I'm not sure if this is possible or not, but I think Overcommit does something along these lines; when you run it, it git stashes any uncommitted code first, so that it only runs your commit/push hooks against the relevant code.

Could RubyCritic do something similar, to allow checking uncommitted code against another branch? Currently you have to commit first (as far as I'm aware).

I think the sequence currently goes:

  1. git checkout [branch to compare against] (fails here if there is uncommitted code)
  2. rubycritic 1st run
  3. git checkout [branch you ran rubycritic in]
  4. rubycritic 2nd run

If instead it went:

  1. git stash
  2. git checkout [branch to compare against]
  3. rubycritic 1st run
  4. git checkout [branch you ran rubycritic in]
  5. git stash pop
  6. rubycritic 2nd run

... would that work? And if so, would it be a sensible default behaviour? Or is there a reason this might be a bad idea? (Technical or philosophical) 🙂

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Start by tracing RubyCritic's branch-comparison workflow and its Git checkout calls; determine the safe behavior for uncommitted changes, including stash restoration failures, and define acceptance criteria for comparing the branches without requiring a commit.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, ruby
Domain
cli, devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.