Skip to content

Commit

Permalink
[Fix rubocop#7860] Change AllowInHeredoc option of `Layout/Trailing…
Browse files Browse the repository at this point in the history
…Whitespace` to `true`

Fixes rubocop#7860.

This PR changes `AllowInHeredoc` option of `Layout/TrailingWhitespace`
to `true` by default. The default behavior will be more safe.
  • Loading branch information
koic committed Apr 17, 2020
1 parent 09d46fa commit 87fa700
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions config/default.yml
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/rubocop/cop/layout/trailing_whitespace.rb
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions manual/cops_layout.md
Expand Up @@ -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.

Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -5025,7 +5025,7 @@ RUBY

Name | Default value | Configurable values
--- | --- | ---
AllowInHeredoc | `false` | Boolean
AllowInHeredoc | `true` | Boolean

### References

Expand Down

0 comments on commit 87fa700

Please sign in to comment.