-
Notifications
You must be signed in to change notification settings - Fork 205
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
Use friendlier terminology in YAML.safe_load #378
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure of the psych/ruby community stance on this type of change, but I'm all for it 👍 🚢
There should be a deprecation warning as this would introduce a breaking change. |
@yuki24 Seems like there is https://github.com/ruby/psych/pull/378/files#diff-fcdbfb11714f576f58ba9f866052bc79R338 Line 338 to ~345 |
@sorryeh Nice! Sorry I totally missed it. |
While I agree with the motivation for the change, I'm not sure I agree that changing a public API is appropriate in this case, even with deprecations. That doesn't mean I don't want to merge it, just that I'm very mindful of the upstream consequences, which include more warnings, additional busy work for any project using these arguments, etc. I personally think |
Basically I have no strong opinion concerning this kind of topic, but as for this particular issue, I'm +1 to change the API now. No deprecation warning is needed. |
Okay all my concerns are addressed and I think it’s a good change. |
Replace keyword argumment whitelist_classes and whitelist_symbols. with permitted_classes and permitted_symbols.
* ruby/psych#378 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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)
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)
Some kwarg names of `Psych.safe_load` method has been changed by the following links. - ruby/psych#378 - ruby/ruby@6268098
This is available since Psych 3.1 [[1], [2]], but mandatory since Psych 4.0 [[3]]. Fixes jnunemaker#72 [1]: ruby/psych#358 [2]: ruby/psych#378 [3]: ruby/psych@0767227
Passing in the permitted classes as the second argument was deprecated in Psych 3 (ruby/psych#378) and removed in Psych 4 (ruby/psych#487). Ruby 3.1 ships with Psych 4, so to make the code work for Ruby 2.7 and up, use the `permitted_classes` keyword argument.
This Pull Request deprecates the usage of whitelist. Prefer Permitted over Whitelist where applicable.
Permitted is easier to understand and better terminology.
Original motivation, community efforts examples: