From 87fa700f6b7f9e631a8faf0064d6ffe4906e6fdd Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Fri, 17 Apr 2020 18:14:43 +0900 Subject: [PATCH] [Fix #7860] Change `AllowInHeredoc` option of `Layout/TrailingWhitespace` to `true` Fixes #7860. This PR changes `AllowInHeredoc` option of `Layout/TrailingWhitespace` to `true` by default. The default behavior will be more safe. --- CHANGELOG.md | 4 ++++ config/default.yml | 4 ++-- lib/rubocop/cop/layout/trailing_whitespace.rb | 4 ++-- manual/cops_layout.md | 8 ++++---- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c721e57105e..ccb06d0b744 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ * [#7882](https://github.com/rubocop-hq/rubocop/pull/7882): Fix `Style/CaseEquality` when `AllowOnConstant` is `true` and the method receiver is implicit. ([@rafaelfranca][]) +### Changes + +* [#7860](https://github.com/rubocop-hq/rubocop/issues/7860): Change `AllowInHeredoc` option of `Layout/TrailingWhitespace` to `true` by default. ([@koic][]) + ## 0.82.0 (2020-04-16) ### New features diff --git a/config/default.yml b/config/default.yml index 6f6b8c5b32f..c64fa1e4e50 100644 --- a/config/default.yml +++ b/config/default.yml @@ -1295,8 +1295,8 @@ Layout/TrailingWhitespace: StyleGuide: '#no-trailing-whitespace' Enabled: true VersionAdded: '0.49' - VersionChanged: '0.55' - AllowInHeredoc: false + VersionChanged: '0.83' + AllowInHeredoc: true #################### Lint ################################## ### Warnings diff --git a/lib/rubocop/cop/layout/trailing_whitespace.rb b/lib/rubocop/cop/layout/trailing_whitespace.rb index f4db51c14e2..6052b3b8399 100644 --- a/lib/rubocop/cop/layout/trailing_whitespace.rb +++ b/lib/rubocop/cop/layout/trailing_whitespace.rb @@ -14,14 +14,14 @@ module Layout # # good # x = 0 # - # @example AllowInHeredoc: false (default) + # @example AllowInHeredoc: false # # The line in this example contains spaces after the 0. # # bad # code = <<~RUBY # x = 0 # RUBY # - # @example AllowInHeredoc: true + # @example AllowInHeredoc: true (default) # # The line in this example contains spaces after the 0. # # good # code = <<~RUBY diff --git a/manual/cops_layout.md b/manual/cops_layout.md index f02038a6663..3827dd4fb65 100644 --- a/manual/cops_layout.md +++ b/manual/cops_layout.md @@ -4987,7 +4987,7 @@ EnforcedStyle | `final_newline` | `final_newline`, `final_blank_line` Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged --- | --- | --- | --- | --- -Enabled | Yes | Yes | 0.49 | 0.55 +Enabled | Yes | Yes | 0.49 | 0.83 This cop looks for trailing whitespace in the source code. @@ -5002,7 +5002,7 @@ x = 0 # good x = 0 ``` -#### AllowInHeredoc: false (default) +#### AllowInHeredoc: false ```ruby # The line in this example contains spaces after the 0. @@ -5011,7 +5011,7 @@ code = <<~RUBY x = 0 RUBY ``` -#### AllowInHeredoc: true +#### AllowInHeredoc: true (default) ```ruby # The line in this example contains spaces after the 0. @@ -5025,7 +5025,7 @@ RUBY Name | Default value | Configurable values --- | --- | --- -AllowInHeredoc | `false` | Boolean +AllowInHeredoc | `true` | Boolean ### References