Skip to content

Switch to Rubocop over StandardRB - #140

Merged
koppen merged 7 commits into
mainfrom
run_rubocop
Sep 3, 2026
Merged

Switch to Rubocop over StandardRB#140
koppen merged 7 commits into
mainfrom
run_rubocop

Conversation

@koppen

@koppen koppen commented Sep 3, 2026

Copy link
Copy Markdown
Member

This allows us to extend the configuration and use other plugins, like rubocop-view_component

This allows us to hook in other Rubocop plugins, like
rubocop-view_component.
Copilot AI lite review requested due to automatic review settings September 3, 2026 07:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 lint task (and make it part of the default Rake task).
  • Introduce .rubocop.yml that 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
Comment thread Rakefile Outdated
Copilot AI review requested due to automatic review settings September 3, 2026 07:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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/rake is still required even though the default task now runs :lint (Rubocop) and there are no references to a standard rake 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

Comment thread .rubocop.yml
Copilot AI review requested due to automatic review settings September 3, 2026 07:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 lint depends on the rubocop task, not standard). 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

Comment thread .github/workflows/ruby.yml
Copilot AI review requested due to automatic review settings September 3, 2026 07:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 lint Rake task runs npm run herb:* (via the herb:* tasks), but this workflow only sets up Node and never installs Node dependencies. This will fail in CI because node_modules won’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 legacy standard Rake tasks, but this PR switches CI/README to rubocop/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

Comment thread README.md
Copilot AI review requested due to automatic review settings September 3, 2026 07:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 lint rake task runs Herb via npm run ..., but the README’s code-style instructions don’t mention installing the Node dependencies first (and bin/setup only runs bundle install). Without this, bundle exec rake lint will fail on a fresh checkout.
```bash
bundle exec rake lint

- **Files reviewed:** 4/4 changed files
- **Comments generated:** 2
- **Review effort level:** Lite
</details>

Comment thread .github/workflows/ruby.yml
Comment thread Rakefile
Copilot AI review requested due to automatic review settings September 3, 2026 08:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The changes are straightforward and consistent across docs, Rake tasks, and CI, with only a minor CI improvement suggested.

Review details
  • Files reviewed: 4/5 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread .github/workflows/ruby.yml Outdated
Copilot AI review requested due to automatic review settings September 3, 2026 08:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 a package-lock.json; using npm ci is 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

Comment thread Rakefile
Copilot AI review requested due to automatic review settings September 3, 2026 08:06
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`.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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

  • :lint is described as verifying “code style and formatting”, but it only runs rubocop + herb:lint (no herb:format:check). Since CI now runs bundle 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 install even though a package-lock.json is present; npm ci is 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

Copilot AI review requested due to automatic review settings September 3, 2026 08:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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 lint is described as verifying formatting, but it currently only runs rubocop and herb:lint. Since CI runs bundle exec rake lint, ERB formatting issues that are only caught by herb:format:check won’t be checked. Consider including herb:format:check in the lint task and letting default depend on lint to 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

@koppen
koppen merged commit 576329a into main Sep 3, 2026
10 checks passed
@koppen
koppen deleted the run_rubocop branch September 3, 2026 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants