Skip to content

Commit

Permalink
Merge pull request #366 from tejasbubane/fix-365
Browse files Browse the repository at this point in the history
[Fix #365] Mark `Rails/SquishedSQLHeredocs` unsafe for autocorrection
  • Loading branch information
koic authored Nov 24, 2020
2 parents 9808efd + 95306d1 commit dadaf1b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
### Changes

* [#383](https://github.com/rubocop-hq/rubocop-rails/pull/383): Require RuboCop 0.90 or higher. ([@koic][])
* [#365](https://github.com/rubocop-hq/rubocop-rails/issues/365): Mark `Rails/SquishedSQLHeredocs` unsafe for autocorrection. ([@tejasbubane][])

## 2.8.1 (2020-09-16)

Expand Down
4 changes: 4 additions & 0 deletions config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,10 @@ Rails/SquishedSQLHeredocs:
StyleGuide: 'https://rails.rubystyle.guide/#squished-heredocs'
Enabled: 'pending'
VersionAdded: '2.8'
VersionChanged: '2.9'
# Some SQL syntax (e.g. PostgreSQL comments and functions) requires newlines
# to be preserved in order to work, thus auto-correction is not safe.
SafeAutoCorrect: false

Rails/TimeZone:
Description: 'Checks the correct usage of time zone aware methods.'
Expand Down
6 changes: 4 additions & 2 deletions docs/modules/ROOT/pages/cops_rails.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4056,12 +4056,14 @@ user.touch

| Pending
| Yes
| Yes
| Yes (Unsafe)
| 2.8
| -
| 2.9
|===

Checks SQL heredocs to use `.squish`.
Some SQL syntax (e.g. PostgreSQL comments and functions) requires newlines
to be preserved in order to work, thus auto-correction for this cop is not safe.

=== Examples

Expand Down
2 changes: 2 additions & 0 deletions lib/rubocop/cop/rails/squished_sql_heredocs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ module Cop
module Rails
#
# Checks SQL heredocs to use `.squish`.
# Some SQL syntax (e.g. PostgreSQL comments and functions) requires newlines
# to be preserved in order to work, thus auto-correction for this cop is not safe.
#
# @example
# # bad
Expand Down

0 comments on commit dadaf1b

Please sign in to comment.