Switch to Rubocop over StandardRB - #140
Conversation
This allows us to hook in other Rubocop plugins, like rubocop-view_component.
There was a problem hiding this comment.
🟡 Changes recommended
There are a few clarity/maintainability issues (hidden RuboCop dependency and leftover Standard rake integration/CI step naming) that should be addressed before merging.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates the project’s Ruby linting approach to run RuboCop (configured to inherit StandardRB rules and add plugins like rubocop-view_component) and wires the new lint task into developer docs and CI.
Changes:
- Add a RuboCop-based
rake linttask (and make it part of the default Rake task). - Introduce
.rubocop.ymlthat inherits StandardRB config and enables additional RuboCop plugins/cops. - Update README and GitHub Actions workflow to run
bundle exec rake lint.
File summaries
| File | Description |
|---|---|
| README.md | Updates developer instructions to use rake lint for style checks. |
| Rakefile | Adds RuboCop Rake task and a composite lint task; updates default task. |
| Gemfile | Adds rubocop-view_component and makes StandardRB non-auto-required for RuboCop-driven linting. |
| .rubocop.yml | Adds RuboCop configuration inheriting StandardRB and configuring ViewComponent cops. |
| .github/workflows/ruby.yml | Switches CI lint step to run bundle exec rake lint. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| bundler-cache: true # runs 'bundle install' and caches installed gems automatically | ||
| - name: Standard | ||
| run: bundle exec rake standard | ||
| run: bundle exec rake lint |
There was a problem hiding this comment.
🟡 Changes recommended
The new RuboCop plugin configuration appears inconsistent with the declared bundle dependencies and may cause rake lint/CI to fail unless the referenced plugin gems are added explicitly.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (2)
.github/workflows/ruby.yml:46
- The workflow step is still named "Standard" but now runs
bundle exec rake lint(Rubocop + Herb). Renaming the step will keep CI logs accurate and reduce confusion when searching job output.
- name: Standard
run: bundle exec rake lint
Rakefile:7
standard/rakeis still required even though the default task now runs:lint(Rubocop) and there are no references to astandardrake task in this file. Keeping it can be confusing (it also defines extra tasks); consider removing it if Standard is no longer invoked via Rake.
require "rubocop/rake_task"
require "standard/rake"
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Lite
There was a problem hiding this comment.
🟡 Changes recommended
The updated Ruby workflow lint job runs npm-based Herb tasks without installing Node dependencies and uses an inconsistent actions/setup-node@v7 version, which is likely to break CI.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (1)
Rakefile:8
require "standard/rake"now appears unused after switching the style check to RuboCop (rake lintdepends on therubocoptask, notstandard). Keeping it loads extra tasks and can be confusing for contributors.
require "rubocop/rake_task"
require "standard/rake"
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Lite
There was a problem hiding this comment.
🟡 Changes recommended
The new CI lint workflow sets up Node but does not install Node dependencies, so rake lint will fail when running Herb’s npm run tasks.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (2)
.github/workflows/ruby.yml:48
- The
lintRake task runsnpm run herb:*(via theherb:*tasks), but this workflow only sets up Node and never installs Node dependencies. This will fail in CI becausenode_moduleswon’t be present.
- name: Set up Node
uses: actions/setup-node@v7
- name: Code quality
run: bundle exec rake lint
Rakefile:7
require "standard/rake"now only registers the legacystandardRake tasks, but this PR switches CI/README torubocop/lint. Keeping this require adds an extra load path and keeps unused tasks around, which is confusing for the new lint setup.
require "rubocop/rake_task"
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Lite
There was a problem hiding this comment.
🟡 Changes recommended
The new CI lint job runs rake lint (which shells out to npm) without installing Node dependencies, so it will fail on a clean runner.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (1)
README.md:276
- The
lintrake task runs Herb vianpm run ..., but the README’s code-style instructions don’t mention installing the Node dependencies first (andbin/setuponly runsbundle install). Without this,bundle exec rake lintwill fail on a fresh checkout.
```bash
bundle exec rake lint
- **Files reviewed:** 4/4 changed files
- **Comments generated:** 2
- **Review effort level:** Lite
</details>
There was a problem hiding this comment.
🟡 Changes recommended
The new rake lint task used by CI does not currently run the ERB formatting check despite being described as doing so, which can allow formatting issues to pass CI.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (1)
.github/workflows/ruby.yml:50
- CI uses
npm install, but this repo has apackage-lock.json; usingnpm ciis more deterministic and typically faster/less error-prone in CI.
- name: Install Node dependencies
run: npm install
- Files reviewed: 4/5 changed files
- Comments generated: 1
- Review effort level: Lite
It _is_ experimental after all and fails on CI with > Error: --check mode is not supported with stdin > rake aborted! > Command failed with status (1): [npm run herb:format:check]
We now run `rake rubocop` instead of `rake standard`, or even better; `rake lint`.
There was a problem hiding this comment.
🔵 Needs a closer look
The new rake lint task (now used by CI) doesn’t currently include the ERB formatting check despite being described as covering formatting, so CI will miss format regressions.
Review details
Suppressed comments (2)
Rakefile:17
:lintis described as verifying “code style and formatting”, but it only runsrubocop+herb:lint(noherb:format:check). Since CI now runsbundle exec rake lint, ERB formatting checks won’t run there even though they’re part of the default task.
task default: [:test, :lint, "herb:format:check"]
desc "Verify code style and formatting of Ruby and ERB files"
task lint: ["rubocop", "herb:lint"]
.github/workflows/ruby.yml:50
- CI installs Node dependencies with
npm installeven though apackage-lock.jsonis present;npm ciis typically faster and ensures the install matches the lockfile exactly.
- name: Install Node dependencies
run: npm ci
- Files reviewed: 4/5 changed files
- Comments generated: 0 new
- Review effort level: Lite
There was a problem hiding this comment.
🔵 Needs a closer look
CI now relies on rake lint, but the current lint task does not actually include the ERB format check it claims to verify, so formatting regressions can slip through.
Review details
Suppressed comments (1)
Rakefile:17
rake lintis described as verifying formatting, but it currently only runsrubocopandherb:lint. Since CI runsbundle exec rake lint, ERB formatting issues that are only caught byherb:format:checkwon’t be checked. Consider includingherb:format:checkin thelinttask and lettingdefaultdepend onlintto avoid duplicate runs.
task default: [:test, :lint, "herb:format:check"]
desc "Verify code style and formatting of Ruby and ERB files"
task lint: ["rubocop", "herb:lint"]
- Files reviewed: 4/5 changed files
- Comments generated: 0 new
- Review effort level: Lite
This allows us to extend the configuration and use other plugins, like rubocop-view_component