-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Lint for redundant keyword_init on structs #13501
Comments
This change introduces a behavioral incompatibility with the Struct.new(:bar, keyword_init: true).keyword_init? # => true
Struct.new(:bar).keyword_init? # => nil |
Good catch @koic! The default has changed. Consumers relying on |
Yeah, RuboCop is used widely across applications, libraries, and frameworks, and user programs can include unexpected cases. Rather than focusing on whether it is a predicate method, it is important to consider the potentials for altering existing behavior, which differs from layout changes. |
OK that makes sense.
Would it make sense to have the cop disabled by default with the safety warning that |
Technically, for Ruby 3.2+, it seems possible to pending it by default with |
Is your feature request related to a problem? Please describe.
Ruby 3.2 enables keyword_init on structs without specifying it. https://www.ruby-lang.org/en/news/2022/12/25/ruby-3-2-0-released/
Describe the solution you'd like
A lint for redundant keyword_init: true on structs.
The text was updated successfully, but these errors were encountered: