Skip to content

Fix Rubocop offenses from the new cops in the Ruby upgrade - #77

Merged
pancakereport merged 2 commits into
mainfrom
fix-rubocop-rspec-output
Oct 28, 2026
Merged

pancakereport merged 2 commits into
mainfrom
fix-rubocop-rspec-output

Conversation

@pancakereport

@pancakereport pancakereport commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

The Rubocop lint check fails on every PR, for example #76, because of files those PRs don't touch.

The "upgrade ruby" commit (6ee7100) also upgraded rubocop from 1.65.1 to 1.92.1 and rubocop-rspec from 3.0.4 to 3.10.2. Those versions add cops that NewCops: enable in .rubocop.yml turns on. The lint workflow runs with filter_mode: nofilter, so it checks every file, and every PR fails on the existing code.

This fixes each offense:

  • RSpec/Output: spec/support/ is excluded, since its helpers print the site build progress and the a11y results summary to the CI log on purpose. The two lines in spec/accessibility_spec.rb that list the pages being tested get an inline exception. Rubocop's unsafe autocorrect for this cop deletes the output instead, so it isn't used.
  • RSpec/LeakyLocalVariable: the a11y standards, skipped rules and excluded elements in spec/accessibility_spec.rb become frozen constants, like ALL_PAGES beside them.
  • Style/OneClassPerFile: ConfigValidationError is now defined inside the Jekyll module in _plugins/config_validator.rb, next to the ConfigValidator that raises it. Nothing else refers to it.
  • Bundler/OrderedGems: jekyll-target-blank is sorted into place in Gemfile. Gemfile.lock is unchanged.

Testing

  • bundle exec rubocop passes locally, using the repo's Ruby 3.3.13 and the locked gem versions.
  • bundle exec jekyll build succeeds, and Jekyll::ConfigValidationError still raises with the same message.
  • The accessibility specs (bundle exec rspec) weren't run locally; they need a headless browser.

Rubocop still warns that rubocop-rspec and rubocop-capybara should be loaded with plugins: rather than require: in .rubocop.yml. That's a warning, not a failure, so it's left for later.

🤖 Generated with Claude Code

Upgrading Ruby bumped rubocop-rspec from 3.0.4 to 3.10.2, whose new
RSpec/Output cop (enabled by NewCops) flags the puts in
spec/support/spec_summary.rb. That script prints the a11y test summary
to the CI log on purpose, so exclude it from the cop. The linter checks
every file, so this failed every PR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pancakereport added a commit that referenced this pull request Oct 28, 2026
Reverts "Let spec_summary.rb print the a11y summary", which is now
#77, so this PR only changes the sections page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The previous commit only excluded spec_summary.rb, but upgrading
rubocop to 1.92.1 and rubocop-rspec to 3.10.2 brought more new cops
(enabled by NewCops), so the check still failed:

- RSpec/Output: exclude all of spec/support, whose helpers report on
  the site build and the a11y results in the CI log, and allow the two
  lines in accessibility_spec.rb that list the pages being tested.
- RSpec/LeakyLocalVariable: make the a11y standards, skipped rules and
  excluded elements constants, like ALL_PAGES beside them.
- Style/OneClassPerFile: define ConfigValidationError inside the Jekyll
  module, next to the ConfigValidator that raises it.
- Bundler/OrderedGems: sort jekyll-target-blank into place.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pancakereport pancakereport changed the title Let spec_summary.rb print the a11y summary (fixes Rubocop on every PR) Fix Rubocop offenses from the new cops in the Ruby upgrade Oct 28, 2026
@pancakereport
pancakereport merged commit 3e956fc into main Oct 28, 2026
5 checks passed
@pancakereport
pancakereport deleted the fix-rubocop-rspec-output branch October 28, 2026 21:08
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