Class: RuboCop::Cop::Rails::SquishedSQLHeredocs
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Rails::SquishedSQLHeredocs
- Extended by:
- AutoCorrector
- Includes:
- Heredoc
- Defined in:
- lib/rubocop/cop/rails/squished_sql_heredocs.rb
Overview
Checks SQL heredocs to use ‘.squish`.
Constant Summary collapse
- SQL =
'SQL'
- SQUISH =
'.squish'
- MSG =
'Use `%<expect>s` instead of `%<current>s`.'
- SQL_IDENTIFIER_MARKERS =
/(".+?")|('.+?')|(\[.+?\])/.freeze
Instance Method Summary collapse
Instance Method Details
#on_heredoc(node) ⇒ Object
52 53 54 55 56 57 58 |
# File 'lib/rubocop/cop/rails/squished_sql_heredocs.rb', line 52 def on_heredoc(node) return unless offense_detected?(node) add_offense(node) do |corrector| corrector.insert_after(node, SQUISH) end end |