chore: bump rubocop to ~> 1.86 and rubocop-rspec to ~> 3.9#54
Closed
erimicel wants to merge 1 commit intotypesense:masterfrom
Closed
chore: bump rubocop to ~> 1.86 and rubocop-rspec to ~> 3.9#54erimicel wants to merge 1 commit intotypesense:masterfrom
erimicel wants to merge 1 commit intotypesense:masterfrom
Conversation
Bumps the linting toolchain: - rubocop: 1.72.2 (pinned exact) → ~> 1.86 - rubocop-rspec: ~> 3.6 → ~> 3.9 Loosens rubocop to a pessimistic constraint so it can pick up patch and minor bumps without another Gemfile change. The newer rubocop / rubocop-rspec surfaced ten new offences. Nine of them were two cops misfiring on `spec/spec_helper.rb`, which is integration infrastructure rather than an example file: - `RSpec/Output` flagged the `puts`/`print` calls that report docker-compose startup progress to the operator. They are not assertions on stdout, so the cop's intent does not apply. - `Naming/PredicateMethod` flagged `ensure_typesense_running`, which returns a boolean but has heavy side effects (boots a docker container); renaming to `ensure_typesense_running?` would be misleading. Both cops are excluded only for `spec/spec_helper.rb`, with comments explaining why. The tenth offence was a real but trivial `Style/HashAsLastArrayItem` / `Layout/SpaceInsideHashLiteralBraces` in `collection_spec.rb`, fixed by autocorrect. Verified: `bundle exec rubocop` reports 97 files, 0 offences. Full RSpec suite is unchanged at 151 / 1 / 27 (the single pre-existing `truncate_len` integration failure on master remains, unrelated). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
rubocop:1.72.2(pinned exact) →~> 1.86rubocop-rspec:~> 3.6→~> 3.9Loosens the rubocop constraint to a pessimistic operator so future patch/minor bumps don't require another Gemfile change.
What broke (and why it didn't)
The newer cop set surfaced 10 offences. They split into three groups:
1.
Style/HashAsLastArrayItem+Layout/SpaceInsideHashLiteralBracesincollection_spec.rb(1 real, autocorrected)Pre-existing array-of-hash literal that was missing braces.
bundle exec rubocop -afixed it cleanly:update_schema = { 'fields' => [ - 'name' => 'field', 'drop' => true + { 'name' => 'field', 'drop' => true } ] }2.
RSpec/Outputinspec/spec_helper.rb× 8 (cop misfiring)The new cop flags
puts/printin spec files because it expects output assertions to be wrapped inexpect { }.to output(...).to_stdoutblocks. Butspec/spec_helper.rbhere is integration infrastructure —ensure_typesense_runningboots Typesense via docker-compose and reports startup progress to the operator. Those are not assertions. Auto-correct would either delete or break the progress messages.Resolved by adding a scoped exclusion in
.rubocop.yml:3.
Naming/PredicateMethodinspec/spec_helper.rb× 1 (cop misfiring)ensure_typesense_runningreturns a boolean (whether this test run started the Typesense container, used by theafter(:suite)hook to decide whether to tear it down). But the method has heavy side effects — it pulls a docker image, starts a container, polls a health endpoint, and writes to stdout. Renaming toensure_typesense_running?to satisfy the predicate-naming convention would actively mislead callers about its cost. Same scoped exclusion treatment.Verification
bundle exec rubocop— 97 files inspected, 0 offences.PR Checklist