diff --git a/changelog/change_mark_unsafe_autocorrect_for_style_commented_keyword.md b/changelog/change_mark_unsafe_autocorrect_for_style_commented_keyword.md new file mode 100644 index 00000000000..d84dee47846 --- /dev/null +++ b/changelog/change_mark_unsafe_autocorrect_for_style_commented_keyword.md @@ -0,0 +1 @@ +* [#9989](https://github.com/rubocop/rubocop/issues/9989): Mark `Style/CommentedKeyword` as unsafe auto-correction. ([@koic][]) diff --git a/config/default.yml b/config/default.yml index f797bb86da6..49426a4fedb 100644 --- a/config/default.yml +++ b/config/default.yml @@ -3156,8 +3156,9 @@ Style/CommentAnnotation: Style/CommentedKeyword: Description: 'Do not place comments on the same line as certain keywords.' Enabled: true + SafeAutoCorrect: false VersionAdded: '0.51' - VersionChanged: '1.7' + VersionChanged: '<>' Style/ConditionalAssignment: Description: >- diff --git a/lib/rubocop/cop/style/commented_keyword.rb b/lib/rubocop/cop/style/commented_keyword.rb index cf8b46ba149..b3032206517 100644 --- a/lib/rubocop/cop/style/commented_keyword.rb +++ b/lib/rubocop/cop/style/commented_keyword.rb @@ -12,6 +12,7 @@ module Style # # Auto-correction removes comments from `end` keyword and keeps comments # for `class`, `module`, `def` and `begin` above the keyword. + # It is marked as unsafe auto-correction as it may remove meaningful comments. # # @example # # bad