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

Change kwarg names of Psych in Ruby 2.6 #6470

Merged
merged 1 commit into from
Nov 12, 2018

Conversation

koic
Copy link
Member

@koic koic commented Nov 12, 2018

This PR fixes the follwoing error.

% ruby -v
ruby 2.6.0dev (2018-11-11 trunk 65667) [x86_64-darwin17]
% bundle exec rake
Files:         514
Modules:        80 (   11 undocumented)
Classes:       485 (    3 undocumented)
Constants:     751 (  738 undocumented)
Attributes:     26 (    0 undocumented)
Methods:      1163 ( 1037 undocumented)
 28.58% documented
 rake aborted!
 ArgumentError: unknown keywords: whitelist_classes, whitelist_symbols
 /Users/koic/src/github.com/rubocop-hq/rubocop/lib/rubocop/config_loader.rb:189:in `yaml_safe_load'
 /Users/koic/src/github.com/rubocop-hq/rubocop/lib/rubocop/config_loader.rb:162:in `load_yaml_configuration'
 /Users/koic/src/github.com/rubocop-hq/rubocop/lib/rubocop/config_loader.rb:41:in `load_file'
 /Users/koic/src/github.com/rubocop-hq/rubocop/lib/rubocop/config_loader.rb:107:in `default_configuration'
 tasks/cops_documentation.rake:247:in `main'
 tasks/cops_documentation.rake:262:in `block in <top (required)>'
 /Users/koic/.rbenv/versions/2.6.0-dev/bin/bundle:30:in `block in <main>'
 /Users/koic/.rbenv/versions/2.6.0-dev/bin/bundle:22:in `<main>'
 Tasks: TOP => default => generate_cops_documentation
 (See full trace by running task with --trace)

These kwarg names has been changed by the following links.

For these kwarg names change, This PR will not add the new conditional branch
using Gem::Version.new(Psych::VERSION). It is the same as for the following reasons.

Because the kwargs API was not included in the latest stable psych gemrelease, 3.0.3:
https://github.com/ruby/psych/blob/v3.0.3/lib/psych.rb#L318
It's only been a part of beta releases of the next minor.
No real user will be affected by the API change.

ruby/psych#378 (comment)


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.

This PR fixes the follwoing error.

```console
% ruby -v
ruby 2.6.0dev (2018-11-11 trunk 65667) [x86_64-darwin17]
% bundle exec rake
Files:         514
Modules:        80 (   11 undocumented)
Classes:       485 (    3 undocumented)
Constants:     751 (  738 undocumented)
Attributes:     26 (    0 undocumented)
Methods:      1163 ( 1037 undocumented)
 28.58% documented
 rake aborted!
 ArgumentError: unknown keywords: whitelist_classes, whitelist_symbols
 /Users/koic/src/github.com/rubocop-hq/rubocop/lib/rubocop/config_loader.rb:189:in `yaml_safe_load'
 /Users/koic/src/github.com/rubocop-hq/rubocop/lib/rubocop/config_loader.rb:162:in `load_yaml_configuration'
 /Users/koic/src/github.com/rubocop-hq/rubocop/lib/rubocop/config_loader.rb:41:in `load_file'
 /Users/koic/src/github.com/rubocop-hq/rubocop/lib/rubocop/config_loader.rb:107:in `default_configuration'
 tasks/cops_documentation.rake:247:in `main'
 tasks/cops_documentation.rake:262:in `block in <top (required)>'
 /Users/koic/.rbenv/versions/2.6.0-dev/bin/bundle:30:in `block in <main>'
 /Users/koic/.rbenv/versions/2.6.0-dev/bin/bundle:22:in `<main>'
 Tasks: TOP => default => generate_cops_documentation
 (See full trace by running task with --trace)
 ```

These kwarg names has been changed by the following links.

- ruby/psych#378
- ruby/ruby@6268098

For these kwarg names change, This PR will not add the new conditional branch
using `Gem::Version.new(Psych::VERSION)`. It is the same as for the following reasons.

> Because the kwargs API was not included in the latest stable psych gemrelease, 3.0.3:
https://github.com/ruby/psych/blob/v3.0.3/lib/psych.rb#L318
> It's only been a part of beta releases of the next minor.
> No real user will be affected by the API change.

ruby/psych#378 (comment)
Copy link
Collaborator

@Drenmi Drenmi left a comment

Choose a reason for hiding this comment

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

🚀

Copy link
Contributor

@JuanitoFatas JuanitoFatas left a comment

Choose a reason for hiding this comment

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

Thanks 👍

@bbatsov bbatsov merged commit 4910866 into rubocop:master Nov 12, 2018
@bbatsov
Copy link
Collaborator

bbatsov commented Nov 12, 2018

👍

@koic koic deleted the change_psych_kwarg_names_for_ruby_2_6 branch November 12, 2018 12:43
koic added a commit to koic/rubocop that referenced this pull request Jun 17, 2019
This PR suppresses the following `Psych.parse` args warn when using
Psych 3.1.0 (Ruby 2.6+).

```console
% ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin17]
% RUBYOPT=-w bundle exec rubocop
(snip)

/Users/koic/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rubocop-0.71.0/lib/
rubocop/yaml_duplication_checker.rb:8:
Passing filename with the 2nd argument of Psych.parse is deprecated. Use
keyword argument like Psych.parse(yaml, filename: ...) instead.
```

The above `Psych.parse` interface has been changed by the following link.
ruby/psych@4d4439d

Related PR ... rubocop#6470
bbatsov pushed a commit that referenced this pull request Jun 18, 2019
This PR suppresses the following `Psych.parse` args warn when using
Psych 3.1.0 (Ruby 2.6+).

```console
% ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin17]
% RUBYOPT=-w bundle exec rubocop
(snip)

/Users/koic/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rubocop-0.71.0/lib/
rubocop/yaml_duplication_checker.rb:8:
Passing filename with the 2nd argument of Psych.parse is deprecated. Use
keyword argument like Psych.parse(yaml, filename: ...) instead.
```

The above `Psych.parse` interface has been changed by the following link.
ruby/psych@4d4439d

Related PR ... #6470
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

4 participants