Skip to content

Update Ruby and Rails versions with RBS and RuboCop adjustments#11

Merged
Syati merged 8 commits intomainfrom
ruby_4_0
Feb 28, 2026
Merged

Update Ruby and Rails versions with RBS and RuboCop adjustments#11
Syati merged 8 commits intomainfrom
ruby_4_0

Conversation

@Syati
Copy link
Owner

@Syati Syati commented Feb 28, 2026

This pull request introduces support for Ruby 4.0 and Rails 8.1, improves compatibility for RBS Inline type-checking (Ruby 3.3+), and refines development tooling configuration. The changes ensure that the codebase can be built and tested across multiple Ruby and Rails versions, and that static type checking and linting adapt automatically to the Ruby version in use.

Ruby and Rails version support:

  • Added Ruby 4.0 and Rails 8.1 to the CI matrix in .github/workflows/main.yml, ensuring tests run on the latest versions.
  • Updated .ruby-version to 4.0.0 and increased the minimum required Ruby version in structured_params.gemspec to 3.2.0. [1] [2]

RBS Inline and static analysis tooling:

  • Refactored Gemfile and .rubocop.yml to conditionally enable rbs-inline, rubocop-rbs_inline, and steep only for Ruby 3.3+; added a separate .rubocop_rbs.yml for RBS Inline configuration. [1] [2] [3]
  • Updated Rakefile to select the appropriate RuboCop config and enable Steep tasks only when running on Ruby 3.3+.

General maintenance and annotation:

Copilot AI review requested due to automatic review settings February 28, 2026 18:09
@Syati Syati self-assigned this Feb 28, 2026
@Syati Syati merged commit e3d6715 into main Feb 28, 2026
22 checks passed
@Syati Syati deleted the ruby_4_0 branch February 28, 2026 18:10
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the project to support newer Ruby/Rails versions (Ruby 4.0, Rails 8.1) while making RBS Inline / RuboCop / Steep tooling conditional on Ruby version to preserve compatibility across the CI matrix.

Changes:

  • Expanded CI to include Ruby 4.0 and Rails 8.1 combinations.
  • Updated Ruby version requirements (.ruby-version, gemspec minimum Ruby) and adjusted dev tooling to enable RBS Inline/Steep only on Ruby 3.3+.
  • Added .rubocop_rbs.yml and updated Rake/RuboCop invocation to select the appropriate config per Ruby version.

Reviewed changes

Copilot reviewed 18 out of 20 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
structured_params.gemspec Raises minimum supported Ruby and adds rbs_inline header.
.ruby-version Sets default development Ruby to 4.0.0.
.github/workflows/main.yml Expands Ruby/Rails CI matrix; exports env vars for steps.
Gemfile Conditionally includes rbs-inline / rubocop-rbs_inline / steep for Ruby 3.3+.
Rakefile Selects RuboCop config by Ruby version and conditionally enables Steep tasks.
.rubocop.yml Removes rubocop-rbs_inline plugin from the default config.
.rubocop_rbs.yml Adds a dedicated RuboCop config intended for Ruby 3.3+ with RBS Inline cops.
bin/rubocop Adds wrapper to run RuboCop with the correct config by Ruby version.
bin/console Adds rbs_inline header.
Steepfile Adds rbs_inline header.
lib/structured_params/params.rb Refines inline RBS annotations for structured validation helpers.
lib/structured_params/type/object.rb Minor formatting tweak near RBS comment/delegate.
spec/spec_helper.rb Adds rbs_inline header.
spec/params_spec.rb Adds rbs_inline header.
spec/errors_spec.rb Adds rbs_inline header.
spec/type/array_spec.rb Adds rbs_inline header and a method signature for the dummy class name.
spec/type/object_spec.rb Adds rbs_inline header and a method signature for the dummy class name.
spec/factories/user_parameters.rb Adds rbs_inline header.
spec/factories/hobby_parameters.rb Adds rbs_inline header.
spec/factories/address_parameters.rb Adds rbs_inline header.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +2 to +6
inherit_from: .rubocop.yml

plugins:
- rubocop-rbs_inline

Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

In .rubocop_rbs.yml, defining plugins: will override the plugins: list inherited from .rubocop.yml unless you explicitly merge. That can cause inherited cop configuration (e.g., RSpec/*) to become “unrecognized cop” when running with this config. Include the full plugin list here (rspec/rake/factory_bot + rbs_inline) or add an inherit_mode merge for plugins so all required plugins remain enabled.

Copilot uses AI. Check for mistakes.
Comment on lines +34 to +38
if RUBY_VERSION >= '3.3.0'
gem 'rbs-inline', require: false
gem 'rubocop-rbs_inline', require: false
gem 'steep', require: false
end
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

RUBY_VERSION >= '3.3.0' compares strings lexicographically, which can give incorrect results for versions like 3.10.0. Use Gem::Version comparisons (or a helper constant) for reliable version gating.

Copilot uses AI. Check for mistakes.
Comment on lines +12 to +16
rubocop_config = if RUBY_VERSION >= '3.3.0'
'.rubocop_rbs.yml'
else
'.rubocop.yml'
end
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

The RUBY_VERSION >= '3.3.0' check here is a lexicographic string comparison and can misbehave for versions like 3.10.0. Prefer Gem::Version comparisons for this gate.

Copilot uses AI. Check for mistakes.
- name: Set Rails version
run: |
echo "RAILS_VERSION=${{ matrix.rails }}" >> $GITHUB_ENV
echo "RUBY_VERSION=${{ matrix.ruby }}" >> $GITHUB_ENV
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

RUBY_VERSION is exported to $GITHUB_ENV here, but the workflow doesn’t reference it later (matrix values are used directly). Consider removing this line to avoid unused configuration, or use it in subsequent steps if it’s intended for tooling.

Suggested change
echo "RUBY_VERSION=${{ matrix.ruby }}" >> $GITHUB_ENV

Copilot uses AI. Check for mistakes.
Comment on lines +25 to +29
if RUBY_VERSION >= '3.3.0'
require 'steep/rake_task'
Steep::RakeTask.new
default_tasks << :steep
end
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

The Ruby-version gate for enabling Steep uses RUBY_VERSION >= '3.3.0' (string comparison). Use Gem::Version comparisons so the condition stays correct across all future Ruby version formats.

Copilot uses AI. Check for mistakes.
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