-
-
Notifications
You must be signed in to change notification settings - Fork 640
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
Suppress keyword arguments warning for Ruby 2.7.0 #612
Suppress keyword arguments warning for Ruby 2.7.0 #612
Conversation
## Summary This PR suppresses the following keyword arguments warning for Ruby 2.7.0. ```console % ruby -v ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin17] % DB=sqlite bundle exec appraisal activerecord_6.0.0 rake /Users/koic/src/github.com/CanCanCommunity/cancancan/lib/cancan/unauthorized_message_resolver.rb:9: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call /Users/koic/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/i18n-1.8.0/lib/i18n.rb:195: warning: The called method `translate' is defined here ``` For Ruby 2.8.0-dev (Ruby 3.0) the warning will be `ArgumentError`. ruby/ruby#2794 ## Other Infromation There are other similar warnings against Active Record, but Rails 6.0 stable branch is WIP. rails/rails#37935 It is not subject to changes in this repository.
Ruby 2.7.0 has been released. This PR adds Ruby 2.7.0 matrix. And the matrix excludes Rails 4.2 testing to prevent the following error. ```console NoMethodError: undefined method `new' for BigDecimal:Class ``` - https://travis-ci.org/CanCanCommunity/cancancan/jobs/635119862 - https://travis-ci.org/CanCanCommunity/cancancan/jobs/635119863 The behavior of `BigDecimal.new` between Ruby 2.6 and Ruby 2.7 has the following differences. ```console % ruby -rbigdecimal -ve 'BigDecimal.new(42)' ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin17] -e:1: warning: BigDecimal.new is deprecated; use BigDecimal() method instead. ``` ```console % ruby -rbigdecimal -ve 'BigDecimal.new(42)' ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin17] Traceback (most recent call last): -e:1:in `<main>': undefined method `new' for BigDecimal:Class (NoMethodError) ``` Rails 4.2 is no longer maintained and will not be backported to support Ruby 2.7. https://guides.rubyonrails.org/maintenance_policy.html Therefore, this PR excludes the matrix of the combination of Ruby 2.7 and Rails 4.2.
6b68228
to
7e6011a
Compare
@@ -32,6 +33,8 @@ matrix: | |||
gemfile: gemfiles/activerecord_6.0.0.gemfile | |||
- rvm: 2.4.2 | |||
gemfile: gemfiles/activerecord_6.0.0.gemfile | |||
- rvm: 2.7.0 | |||
gemfile: gemfiles/activerecord_4.2.0.gemfile |
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.
The matrix excludes Rails 4.2 testing to prevent the following error.
NoMethodError:
undefined method `new' for BigDecimal:Class
- https://travis-ci.org/CanCanCommunity/cancancan/jobs/635119862
- https://travis-ci.org/CanCanCommunity/cancancan/jobs/635119863
The behavior of BigDecimal.new
between Ruby 2.6 and Ruby 2.7 has the following differences.
% ruby -rbigdecimal -ve 'BigDecimal.new(42)'
ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin17]
-e:1: warning: BigDecimal.new is deprecated; use BigDecimal() method instead.
% ruby -rbigdecimal -ve 'BigDecimal.new(42)'
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin17]
Traceback (most recent call last):
-e:1:in `<main>': undefined method `new' for BigDecimal:Class (NoMethodError)
Rails 4.2 is no longer maintained and will not be backported to support Ruby 2.7.
https://guides.rubyonrails.org/maintenance_policy.html
Therefore, this PR excludes the matrix of the combination of Ruby 2.7 and Rails 4.2.
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.
Nice. Thank you!
To pick up the fix for keyword arguments warning in Ruby 2.7, added in CanCanCommunity/cancancan#612 https://github.com/CanCanCommunity/cancancan/blob/develop/CHANGELOG.md#310
Summary
This PR suppresses the following keyword arguments warning for Ruby 2.7.0.
For Ruby 2.8.0-dev (Ruby 3.0) the warning will be
ArgumentError
.ruby/ruby#2794
Other Infromation
There are other similar warnings against Active Record, but Rails 6.0 stable branch is WIP.
rails/rails#37935
It is not subject to changes in this repository.