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

Drop Ruby 2.2.0 and 2.2.1 to use Psych 3.1 #6766

Merged
merged 1 commit into from
Feb 15, 2019
Merged

Conversation

pocke
Copy link
Collaborator

@pocke pocke commented Feb 13, 2019

see #6733 (comment)

This pull request drops supporting Ruby 2.2.0 and 2.2.1 to use Psych 3.1.

Parameter style of YAML.load has been changed since Psych 3.1. Psych 3.1 still supports the old parameter style, but it displays a warning. So we need to change the behaviour between Psych 3.1 and others to avoid the warning. We can delete the branch by dropping old versions of Psych.

And Psych 3.1 also has a location feature. I'd like to use the feature in #6733.

Note: I'd like to drop Ruby 2.2 also. Personally, I think we can drop it after Ruby 2.3 EOL, it is March 2019.
I'm looking forward to using Safe Navigation Operator in RuboCop! 😉


Before submitting the PR make sure the following are checked:

  • 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.
  • Added an entry to the Changelog if the new code introduces user-observable changes. See changelog entry format.
  • The PR relates to only one subject with a clear title
    and description in grammatically correct, complete sentences.
  • Run bundle exec rake default. It executes all tests and RuboCop for itself, and generates the documentation.

@pocke pocke mentioned this pull request Feb 13, 2019
10 tasks
@koic koic merged commit 04765f9 into rubocop:master Feb 15, 2019
@koic
Copy link
Member

koic commented Feb 15, 2019

Thanks!

@pocke pocke deleted the use-psych-3.1 branch February 15, 2019 01:58
@koic
Copy link
Member

koic commented Feb 15, 2019

I'd like to drop Ruby 2.2 also. Personally, I think we can drop it after Ruby 2.3 EOL, it is March 2019.

I think so too :-)

@Drenmi Drenmi mentioned this pull request Feb 19, 2019
@pocke
Copy link
Collaborator Author

pocke commented Feb 19, 2019

ruby/psych#385

Installing RuboCop 0.65.0 has a problem on Windows by using Psych 3.1.
I guess it is not RuboCop matter, but I just put a link to the issue.

@@ -38,6 +38,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency('parallel', '~> 1.10')
s.add_runtime_dependency('parser', '>= 2.5', '!= 2.5.1.1')
s.add_runtime_dependency('powerpack', '~> 0.1')
s.add_runtime_dependency('psych', '>= 3.1.0')
Copy link
Collaborator

Choose a reason for hiding this comment

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

@pocke Adding this as a runtime dependency seems to break a lot of people's environments. See #6781. Can we get around this somehow?

@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
s.name = 'rubocop'
s.version = RuboCop::Version::STRING
s.platform = Gem::Platform::RUBY
s.required_ruby_version = '>= 2.2.0'
s.required_ruby_version = '>= 2.2.2'
Copy link

@coldnebo coldnebo Mar 8, 2019

Choose a reason for hiding this comment

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

I would add to @Drenmi's comment by saying that if you are going to require psych 3.1.0, you should probably require ruby 2.6.0 or greater as that seems to be when ruby core made the switch to psych 3.1.0.

Note that psych is used by Ruby core, which creates dependency issues that cannot be resolved by Bundler.

@coldnebo
Copy link

coldnebo commented Mar 8, 2019

The version requirements in this PR do have an impact, but it is complicated.

See my comment in #6781.

koic added a commit to koic/rails that referenced this pull request Mar 26, 2019
### Summary

RuboCop 0.66.0 has been released.
https://github.com/rubocop-hq/rubocop/releases/tag/v0.66.0

And rubocop-0-66 channel is available in Code Climate.
https://github.com/codeclimate/codeclimate/releases/tag/v0.84.0

RuboCop 0.66.0 fixed the false negative to indentation for
modifier. And this PR applied the auto-correction fixed by it.
rubocop/rubocop#6792

In addtion, this PR is also updating the following 4 gems that
RuboCop depends on.

- Update Psych gem ... rubocop/rubocop#6766
- Update Parser gem to 2.6.2.0 that supports Ruby 2.5.5 and 2.6.2 ...
 https://github.com/whitequark/parser/blob/v2.6.2.0/CHANGELOG.md#changelog
- Remove powerpack gem ... rubocop/rubocop#6806
- Update unicode-display_width gem ... rubocop/rubocop#6813
koic added a commit to koic/rubocop that referenced this pull request May 18, 2022
Follow up rubocop#10632 (comment).

Reverts part of rubocop#6766, rubocop#7026, and rubocop#7030.

Only the Ruby version (2.2) to runtime should have been dropped, not code analysis.
This PR makes Ruby 2.2 code analysis with `TargetRubyVersion: 2.2`.
It aims to solve essentially the same problem as rubocop#10626, rubocop#10632, and rubocop#10640.

Previously, there was the following default enforced style `when_needed` for
`Style/FrozenStringLiteralComment` cop.

```ruby
# @example EnforcedStyle: when_needed (default)
#   # The `when_needed` style will add the frozen string literal
#   # to files only when the `TargetRubyVersion` is set to 2.3+.
#   # bad
#   module Foo
#     # ...
#   end
#
#   # good
#   # frozen_string_literal: true
#
#   module Foo
#     # ...
#   end
```

This PR does not restore that option, but sets the `minimum_target_ruby_version 2.3`
to make `always (default)` apply by default. It is a simple solution that does not
handle frozen literal magic comment added in Ruby 2.3 when `TargetRubyVersion` is
Ruby 2.2 or lower.
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.

4 participants