From eeb00eb7c77131c9940e389f4ec4c00e5e97a577 Mon Sep 17 00:00:00 2001 From: Marc-Andre Lafortune Date: Thu, 10 Sep 2020 11:15:56 -0400 Subject: [PATCH] Default changed to disallow `Layout/TrailingWhitespace` in heredoc. --- CHANGELOG.md | 1 + config/default.yml | 2 +- docs/modules/ROOT/pages/cops_layout.adoc | 6 +++--- lib/rubocop/cop/layout/trailing_whitespace.rb | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d95026ee81..c5b52d82be5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ * [#8882](https://github.com/rubocop-hq/rubocop/pull/8882): **(Potentially breaking)** RuboCop assumes that Cop classes do not define new `on_` methods at runtime (e.g. via `extend` in `initialize`). ([@marcandre][]) * [#7966](https://github.com/rubocop-hq/rubocop/issues/7966): **(Breaking)** Enable all pending cops for RuboCop 1.0. ([@koic][]) * [#8490](https://github.com/rubocop-hq/rubocop/pull/8490): **(Breaking)** Change logic for cop department name computation. Cops inside deep namespaces (5 or more levels deep) now belong to departments with names that are calculated by joining module names starting from the third one with slashes as separators. For example, cop `Rubocop::Cop::Foo::Bar::Baz` now belongs to `Foo/Bar` department (previously it was `Bar`). ([@dsavochkin][]) +* [#8692](https://github.com/rubocop-hq/rubocop/pull/8692): Default changed to disallow `Layout/TrailingWhitespace` in heredoc. ([@marcandre][]) ## 0.93.1 (2020-10-12) diff --git a/config/default.yml b/config/default.yml index 9d3bf8129a2..05104802b7c 100644 --- a/config/default.yml +++ b/config/default.yml @@ -1335,7 +1335,7 @@ Layout/TrailingWhitespace: Enabled: true VersionAdded: '0.49' VersionChanged: '0.83' - AllowInHeredoc: true + AllowInHeredoc: false #################### Lint ################################## ### Warnings diff --git a/docs/modules/ROOT/pages/cops_layout.adoc b/docs/modules/ROOT/pages/cops_layout.adoc index 0e47de9ca53..fd34e085b79 100644 --- a/docs/modules/ROOT/pages/cops_layout.adoc +++ b/docs/modules/ROOT/pages/cops_layout.adoc @@ -6360,7 +6360,7 @@ x = 0 x = 0 ---- -==== AllowInHeredoc: false +==== AllowInHeredoc: false (default) [source,ruby] ---- @@ -6382,7 +6382,7 @@ code = <<~RUBY RUBY ---- -==== AllowInHeredoc: true (default) +==== AllowInHeredoc: true [source,ruby] ---- @@ -6399,7 +6399,7 @@ RUBY | Name | Default value | Configurable values | AllowInHeredoc -| `true` +| `false` | Boolean |=== diff --git a/lib/rubocop/cop/layout/trailing_whitespace.rb b/lib/rubocop/cop/layout/trailing_whitespace.rb index d896bb4bf4b..525bc235220 100644 --- a/lib/rubocop/cop/layout/trailing_whitespace.rb +++ b/lib/rubocop/cop/layout/trailing_whitespace.rb @@ -14,7 +14,7 @@ module Layout # # good # x = 0 # - # @example AllowInHeredoc: false + # @example AllowInHeredoc: false (default) # # The line in this example contains spaces after the 0. # # bad # code = <<~RUBY @@ -32,7 +32,7 @@ module Layout # x = 0#{trailing_whitespace} # RUBY # - # @example AllowInHeredoc: true (default) + # @example AllowInHeredoc: true # # The line in this example contains spaces after the 0. # # good # code = <<~RUBY