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

[Fix #10036] Mark Style/StructInheritance as unsafe auto-correction #10037

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1 @@
* [#10036](https://github.com/rubocop/rubocop/issues/10036): Mark `Style/StructInheritance` as unsafe auto-correction. ([@koic][])
3 changes: 2 additions & 1 deletion config/default.yml
Expand Up @@ -4694,8 +4694,9 @@ Style/StructInheritance:
Description: 'Checks for inheritance from Struct.new.'
StyleGuide: '#no-extend-struct-new'
Enabled: true
SafeAutoCorrect: false
VersionAdded: '0.29'
VersionChanged: '0.86'
VersionChanged: '<<next>>'

Style/SwapValues:
Description: 'This cop enforces the use of shorthand-style swapping of 2 variables.'
Expand Down
3 changes: 3 additions & 0 deletions lib/rubocop/cop/style/struct_inheritance.rb
Expand Up @@ -5,6 +5,9 @@ module Cop
module Style
# This cop checks for inheritance from Struct.new.
#
# It is marked as unsafe auto-correction because it will change the
# inheritance tree (e.g. return value of `Module#ancestors`).
#
# @example
# # bad
# class Person < Struct.new(:first_name, :last_name)
Expand Down