Skip to content

Load rubocop-rake and rubocop-rspec plugins (herb-embedded-5g1) - #54

Merged
jleo3 merged 1 commit into
mainfrom
herb-embedded-5g1
Aug 18, 2026
Merged

Load rubocop-rake and rubocop-rspec plugins (herb-embedded-5g1)#54
jleo3 merged 1 commit into
mainfrom
herb-embedded-5g1

Conversation

@jleo3

@jleo3 jleo3 commented Aug 18, 2026

Copy link
Copy Markdown
Member

Summary

  • rubocop-rake/rubocop-rspec were already dev dependencies but never actually loaded (require: false, no require/plugins key in .rubocop.yml) — hence RuboCop's own "extension libraries are installed but not loaded" suggestion. Adds a plugins: key (the modern mechanism, per docs.rubocop.org/rubocop/plugins.html) to actually load both.
  • rubocop-rake found nothing (Rakefile/rakelib are small). rubocop-rspec surfaced 136 offenses across 11 cops — addressed as a mix of real fixes and documented configuration, not a blanket disable.

Fixed:

  • include_examplesit_behaves_like (verified safe — the shared example group's bare subject still resolves correctly through the nested context).
  • Named an anonymous subject.
  • Converted a message expectation to the spy pattern (allow/have_received).
  • Split report_spec.rb's two top-level describes into report_spec.rb and lint_result_spec.rb — also fixes a pre-existing violation of CLAUDE.md's own "one spec file per lib unit" convention.
  • Applied safe autocorrects for scattered lets and simple-regex-as-string matchers.

Configured (each with a comment explaining why):

  • RSpec/SpecFilePathFormat disabled — this suite's spec/ is deliberately flat, not nested to mirror lib/'s namespace dirs.
  • RSpec/ExampleLength/RSpec/MultipleExpectations raised to 25/8 — picked after checking the actual worst offenders (22 lines / 7 expectations), not arbitrary; this suite favors thorough, narrative examples over one-assertion-per-it.
  • RSpec/DescribeClass excluded for the three specs that describe a scenario or guarantee rather than one Ruby class.
  • One inline (not global) disable for RSpec/LeakyLocalVariable where the flagged pattern is a per-.each-iteration closure local, not the cross-example leak the cop targets.

Acceptance criteria

  • rubocop-rake/rubocop-rspec in the Gemfile dev group and Gemfile.lock — already present from a prior bead.
  • Both listed under a plugins: key in .rubocop.yml.
  • bundle exec rake runs clean — no "extension libraries" nag, and every offense fixed or explicitly configured with reasoning.
  • Full local gate passes: 45 files, 0 RuboCop offenses, 206 examples, 0 failures, no vulnerabilities.

Test plan

  • bundle exec rake (RuboCop + full RSpec suite + bundler-audit) passes locally.
  • Each it_behaves_like conversion re-verified in isolation (14 examples, 0 failures) to confirm shared-example subject resolution is unchanged.

🤖 Generated with Claude Code

rubocop-rake and rubocop-rspec were already dev dependencies but never
actually loaded (require: false, no require/plugins key in .rubocop.yml)
- hence RuboCop's own "extension libraries are installed but not loaded"
suggestion. Adds a `plugins:` key (the modern mechanism, per
docs.rubocop.org/rubocop/plugins.html) to load both.

rubocop-rake found nothing (Rakefile/rakelib are small). rubocop-rspec
surfaced 136 offenses across 11 cops, addressed as a mix of real fixes and
documented configuration - not a blanket disable:

Fixed: include_examples -> it_behaves_like (verified safe: the shared
example group's bare `subject` still resolves correctly through the
nested context); named an anonymous subject; converted a message
expectation to the spy pattern; split report_spec.rb's two top-level
describes into report_spec.rb and lint_result_spec.rb (also fixes a
pre-existing violation of CLAUDE.md's own "one spec file per lib unit"
convention); applied safe autocorrects for scattered lets and
simple-regex-as-string matchers.

Configured, each with a comment explaining why: RSpec/SpecFilePathFormat
disabled (this suite's spec/ is deliberately flat, not nested to mirror
lib/'s namespace dirs); RSpec/ExampleLength and RSpec/MultipleExpectations
raised to 25/8 (picked after checking the actual worst offenders - 22
lines/7 expectations - not arbitrary; this suite favors thorough,
narrative examples over one-assertion-per-it); RSpec/DescribeClass
excluded for the three specs that describe a scenario or guarantee rather
than one Ruby class. One inline disable (not global) for
RSpec/LeakyLocalVariable where the flagged pattern is a per-.each-iteration
closure local, not the cross-example leak the cop targets.

bundle exec rake: 45 files, 0 RuboCop offenses, 206 examples 0 failures,
no vulnerabilities found.
@jleo3
jleo3 merged commit f9d8a16 into main Aug 18, 2026
1 check passed
@jleo3
jleo3 deleted the herb-embedded-5g1 branch August 18, 2026 20:46
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.

1 participant