Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relax required ruby version #29

Merged
merged 3 commits into from
Jan 12, 2022
Merged

Relax required ruby version #29

merged 3 commits into from
Jan 12, 2022

Conversation

davidrapson
Copy link
Contributor

@davidrapson davidrapson commented Jan 7, 2022

A recent change restricted the required ruby version for this project to 3.0.3 or above. We have a few projects running on 2.7 and notably the design-system tests against both 2.7 and 3. Limiting the version to 3 prevents us from using the new version in these contexts.

The rubocop docs for TargetRubyVersion suggest that this respects the project value if this is unset:

Otherwise, RuboCop will then check your project for a series of files where the version may be specified already. The files that will be looked for are .ruby-version, Gemfile.lock, and *.gemspec. If Gemspec file has an array for required_ruby_version, the lowest version will be used. If none of the files are found a default version value will be used.

https://docs.rubocop.org/rubocop/configuration.html#setting-the-target-ruby-version

As the ruby version is a project specific thing it makes sense to defer to the project rather than explicitly setting this in shared rules.

This change removes TargetRubyVersion and widens the required_ruby_version again so we can continue to use this config against 2.7 versions of ruby.

Shout if I've misunderstood the intent of the original change.

A recent change restricted the required ruby version for this project to 3.0.3 or above. We have a few projects running on 2.7 and notably the design-system tests against both 2.7 and 3. Limiting the version to 3 prevents us from using the new version in these contexts.

The rubocop docs for TargetRubyVersion suggest that this respects the project value if this is unset:

> Otherwise, RuboCop will then check your project for a series of files where the version may be specified already. The files that will be looked for are .ruby-version, Gemfile.lock, and *.gemspec. If Gemspec file has an array for required_ruby_version, the lowest version will be used. If none of the files are found a default version value will be used.

https://docs.rubocop.org/rubocop/configuration.html#setting-the-target-ruby-version

As the ruby version is a project specific thing it makes sense to defer to the project rather than explicitly setting this in shared rules.

This change removes `TargetRubyVersion` and widens the `required_ruby_version` again so we can continue to use this config against 2.7 versions of ruby.
@mrdaniellewis
Copy link
Contributor

I put it in because I had a project complaining I wasn't using Ruby 2.7. But, yes, I think you are correct, it was because the last version had TargetRubyVersion set to 2.7.

This update should be version 5.0.1. Could you update the version file as well, and it needs tagged when merged.

I wasn't sure anyone else was using this. I should have got a PR done before merging my last change.

@mrdaniellewis
Copy link
Contributor

@davidrapson I've updated this as version 6. I've also updated rubocop as leaving binding.break wasn't coming up as an error.

@mrdaniellewis mrdaniellewis merged commit c084221 into main Jan 12, 2022
@mrdaniellewis mrdaniellewis deleted the relax-ruby-version branch January 12, 2022 14:42
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