diff options
Diffstat (limited to 'rubocop/cop/migration/add_limit_to_text_columns.rb')
-rw-r--r-- | rubocop/cop/migration/add_limit_to_text_columns.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/rubocop/cop/migration/add_limit_to_text_columns.rb b/rubocop/cop/migration/add_limit_to_text_columns.rb index a47fbe0bf16..5c71fbbfaa2 100644 --- a/rubocop/cop/migration/add_limit_to_text_columns.rb +++ b/rubocop/cop/migration/add_limit_to_text_columns.rb @@ -10,7 +10,7 @@ module RuboCop # Text columns starting with `encrypted_` are very likely used # by `attr_encrypted` which controls the text length. Those columns # should not add a text limit. - class AddLimitToTextColumns < RuboCop::Cop::Cop + class AddLimitToTextColumns < RuboCop::Cop::Base include MigrationHelpers TEXT_LIMIT_ATTRIBUTE_ALLOWED_SINCE = 2021_09_10_00_00_00 @@ -43,11 +43,11 @@ module RuboCop next unless text_operation?(send_node) if text_operation_with_limit?(send_node) - add_offense(send_node, location: :selector, message: TEXT_LIMIT_ATTRIBUTE_NOT_ALLOWED) if version(node) < TEXT_LIMIT_ATTRIBUTE_ALLOWED_SINCE + add_offense(send_node.loc.selector, message: TEXT_LIMIT_ATTRIBUTE_NOT_ALLOWED) if version(node) < TEXT_LIMIT_ATTRIBUTE_ALLOWED_SINCE else # We require a limit for the same table and attribute name if text_limit_missing?(node, *table_and_attribute_name(send_node)) - add_offense(send_node, location: :selector) + add_offense(send_node.loc.selector) end end end |