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

Reduce minimum RuboCop version back to ~> 1.51 #612

Merged
merged 2 commits into from Feb 14, 2024

Conversation

sambostock
Copy link
Contributor

@sambostock sambostock commented Feb 12, 2024

Since we're introducing the

<% if rubocop_version >= "X.YZ" %>
Dept/Cop:
  Enabled: true
<% end %>

approach to configuring RuboCop without requiring a specific version of the gem (ahead of supporting plugin configs), we should just use that approach to avoid changing the minimum required version in the next release.

⚠️ Before Merging

@sambostock sambostock requested a review from a team as a code owner February 12, 2024 17:02
@github-actions github-actions bot added the config change Changes the Rubocop config by enabling, disabling, or reconfiguring one or many cops label Feb 12, 2024
@sambostock
Copy link
Contributor Author

CI is failing with comparison of Gem::Version with String failed, but that should work... 🤔

@sambostock sambostock force-pushed the reduce-required-rubocop-version branch from 3f20dbb to b5a3b95 Compare February 12, 2024 23:43
@sambostock
Copy link
Contributor Author

sambostock commented Feb 12, 2024

It turns out Gem::Version#<=> only relatively recently learned to accept String arguments, but we can backport the guard clause to be able to use it, which makes the ERB much cleaner.

@sambostock sambostock changed the base branch from main to ci-rubies February 13, 2024 14:59
@sambostock sambostock mentioned this pull request Feb 13, 2024
3 tasks
Base automatically changed from ci-rubies to main February 14, 2024 21:56
As of Rubygems 3.5.6 (included in Ruby 3.2 onwards, and often available
in environments with older Ruby versions where Rubygems has been
updated), `Gem::Version#<=>` supports passing in a `String`, instead of
needing to create a `Gem::Version` to pass in.

If we temporarily add a backport, we can use this approach, which makes
the version checks in the YAML+ERB config files more straightforward.

The backport is done in a separate file so we can leverage the
deduplication `require` provides out of the box, so as not to trigger a
method redefinition warning. It also means we'll be able to import it in
our upcoming plugin config files, rather than duplicating it.
Since we're introducing the

    <% if rubocop_version >= "X.YZ"
    Dept/Cop:
      Enabled: true
    <% end %>

approach to configuring RuboCop without requiring a specific version of
the gem (ahead of supporting plugin configs), we should just use that
approach to avoid changing the minimum required version in the next
release.
@sambostock sambostock force-pushed the reduce-required-rubocop-version branch from b5a3b95 to f1d087c Compare February 14, 2024 21:57
@sambostock sambostock merged commit 069dad7 into main Feb 14, 2024
28 checks passed
@sambostock sambostock deleted the reduce-required-rubocop-version branch February 14, 2024 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
config change Changes the Rubocop config by enabling, disabling, or reconfiguring one or many cops
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants