Shopify / Shopify/packwerk

Refactor cli.rb to be smaller and testable

Open
#70 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

good first issue
Dominant language
Ruby
Stars
1.9k
Forks
121
Avg merge
2m
Merged PRs (30d)
1

Description

As @doodzik mentioned in https://github.com/Shopify/packwerk/pull/61/files#r517545831, we should look into refactoring cli.rb as it is growing to be a large class.

We should move all of the different commands we have in to compositional objects, so we can just do something like command.run. Breaking this class up would make it easier to have unit tests.

I would also be curious to see how RuboCop implements their Cli class.

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

Start by reading cli.rb to map its current commands and responsibilities. Compare the structure with RuboCop's Cli class, then define compositional command objects with a command.run interface and unit-testable boundaries. Done means cli.rb is smaller, commands are separated, and the refactoring makes unit tests easier to add.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
cli
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.