Repository navigation
Fix CI on Ruby 3.0 and add Ruby 4.0 to the matrix - #411
Merged
Merged
Conversation
activesupport 7.1, the newest release installable on Ruby 3.0, passes `quirks_mode:` to `JSON.generate`, which json 3.1 removed. Any `Hash#to_json` then raises `ArgumentError: unknown keyword: quirks_mode`. Newer activesupport releases are not affected, so the pin only applies to Ruby 3.0 and the library's own json requirements stay open.
CI resolves the latest RuboCop, which now flags disable/enable pairs around a single statement and fails the rubocop job before rspec runs. Use rubocop:disable-next instead.
json 3.0 already removed the `quirks_mode:` keyword, so json 3.0.2 still fails with activesupport 7.1 on Ruby 3.0. Only json 2.x works.
danger 9.6 references Git::Base, which git 6.0 no longer loads eagerly, so the Danger job fails with an uninitialized constant before running.
Danger ReportNo issues found. |
danger-changelog only treats a section as unreleased when its heading contains "(Next)" or "[Unreleased]"; "Next release" matched neither, so every new entry was reported as outside the unreleased section.
The disable-next directives need RuboCop 1.90, so the Gemfile now says so. The release docs still described the old "Next Release" heading that Danger does not recognize; they now use the "(Next)" form. Also makes the Ruby version check a Gem::Version comparison and notes when the git pin can go.
ubuntu-latest migrates to Ubuntu 26.04, but there are no prebuilt Ruby 3.0 or 3.1 packages for that image, so those matrix jobs and the rubocop job (Ruby 3.0) would fail at setup. Pin 24.04 until older Rubies are dropped or built for 26.04.
There was a problem hiding this comment.
🟡 Changes recommended
Three active RuboCop suppression-placement issues remain, so the verification job will continue to fail until the directives are moved to the offending lines.
3 open issues
What changed in this PR
This pull request fixes CI compatibility for Ruby 3.0, adds Ruby 4.0 coverage, and updates RuboCop, release documentation, changelog guidance, and Danger workflows.
Changes:
- Adds Ruby-specific dependency constraints, including
json,git, andostruct. - Expands the CI matrix through Ruby 4.0 and uses Ubuntu 24.04.
- Updates RuboCop suppression directives and release/changelog documentation.
- Bumps reusable Danger workflows to v0.1.1.
| File | Review summary |
|---|---|
spec/grape_entity/entity_spec.rb |
Critical: the rubocop:disable-next directive does not suppress the Lint/EmptyBlock offense; it must move immediately before the expose ... do line. (1 vote) |
RELEASING.md |
Documents the new (Next) changelog heading format. |
lib/grape_entity/exposure/nesting_exposure/nested_exposures.rb |
Critical: the Style/DocumentDynamicEvalDefinition directive must move immediately before class_eval. (3 votes) |
lib/grape_entity/entity.rb |
Critical: the Layout/LineLength directive must move immediately before the long raise ArgumentError line or the expression must be wrapped. (3 votes) |
Gemfile |
Adds Ruby-version-aware dependency constraints and development dependencies. |
CONTRIBUTING.md |
Updates changelog contribution guidance. |
CHANGELOG.md |
Adds the 1.1.1 (Next) unreleased heading and records the changes. |
.github/workflows/danger.yml |
Bumps the reusable Danger workflow to v0.1.1. |
.github/workflows/danger-comment.yml |
Bumps the reusable Danger comment workflow to v0.1.1. |
.github/workflows/ci.yml |
Uses Ubuntu 24.04 and adds Ruby 4.0 to the test matrix. |
Review effort: Lite
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
CI on the oldest supported Ruby breaks as soon as anything calls
Hash#to_json, because the newest activesupport that installs there is incompatible with the latest json release. This keeps the Ruby 3.0 job green without restricting the json versions the gem allows for users, and adds Ruby 4.0 to the test matrix so the gem is exercised on the current Ruby.Details
JSON.generate(..., quirks_mode: true), which json 3.0 removed, so{a: 1}.to_jsonraisesArgumentError: unknown keyword: quirks_mode. activesupport 7.2.4 and 8.1.x work with json 3.1, so the Gemfile pin is limited to Ruby 3.0; the gemspec is unchanged.ostructas a default gem, and the specs require it, so it is added to the development group. The library already guardsOpenStructwithdefined?.Style/DirectiveScope) and fails the rubocop job before rspec runs, so those directives becomerubocop:disable-next.gitis pinned below 6 because danger 9.6 referencesGit::Base, which git 6 no longer loads eagerly.1.1.1 (Next): danger-changelog only recognizes headings containing(Next)or[Unreleased].