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

Follow-up clean-up of Ruby < 2.6 #10805

Closed
wants to merge 6 commits into from
Closed

Conversation

pirj
Copy link
Member

@pirj pirj commented Jul 11, 2022

This complements #10577, considering #10625 an #10697.

As we don't run specs on CI for Ruby < 2.5, those specs that would only run on those Ruby versions are now useless.

Spec changes are better viewed without whitespace.


Before submitting the PR make sure the following are checked:

  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • Wrote good commit messages.
  • [-] Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • [-] Added tests.
  • Ran bundle exec rake default. It executes all tests and runs RuboCop on its own code.
  • [-] Added an entry (file) to the changelog folder named {change_type}_{change_description}.md if the new code introduces user-observable changes. See changelog entry format for details.

@dvandersluis
Copy link
Member

dvandersluis commented Jul 11, 2022

FYI this will partially revert a series of older ruby support restoration PRs starting at #10626 so we probably don’t want to do this 😅(specifically the removal of TargetRubyVersion)

@@ -159,7 +159,7 @@ def to_supported_styles(enforced_style)
private

def compatible_external_encoding_for?(src)
src = src.dup if RUBY_VERSION < '2.3' || RUBY_ENGINE == 'jruby'
src = src.dup if RUBY_ENGINE == 'jruby'
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm uncertain if this is still needed on JRuby > 9.2.

Comment on lines -4 to -15
context 'with `else` without `rescue`', :ruby25 do
it 'registers an offense' do
expect_offense(<<~RUBY)
begin
do_something
else
^^^^ `else` without `rescue` is useless.
handle_unknown_errors
end
RUBY
end
end
Copy link
Member Author

Choose a reason for hiding this comment

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

This fails on Ruby 2.6+, and we don't run specs on CI for them.
Is this spec still useful? Is it still possible to run RuboCop specs locally on Ruby 2.5?

@koic
Copy link
Member

koic commented Jul 11, 2022

Ruby 2.5 and below were dropped in runtime versions, not analysis versions. I'm going to close this PR because these codes need to be kept as analysis versions. Thank you.

@koic koic closed this Jul 11, 2022
@pirj
Copy link
Member Author

pirj commented Jul 11, 2022

revert a series of older ruby support restoration PRs

I'd argue with that. My two points are:

  • the same specs are still run across the range of Ruby versions that we run on CI
  • we're properly setting the minimum_target_ruby_version even if it is 2.5 or 2.6, so RuboCop would be able to run the code that is targeted to earlier versions

Still, I might be wrong with those points, or might be missing something else, so I'll be happy to adjust/close the PR.

@pirj pirj deleted the cleanup-old-rubies branch July 11, 2022 21:39
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.

None yet

3 participants