diff options
Diffstat (limited to 'rubocop/cop/database')
-rw-r--r-- | rubocop/cop/database/disable_referential_integrity.rb | 2 | ||||
-rw-r--r-- | rubocop/cop/database/establish_connection.rb | 4 | ||||
-rw-r--r-- | rubocop/cop/database/multiple_databases.rb | 4 | ||||
-rw-r--r-- | rubocop/cop/database/rescue_query_canceled.rb | 2 | ||||
-rw-r--r-- | rubocop/cop/database/rescue_statement_timeout.rb | 2 |
5 files changed, 7 insertions, 7 deletions
diff --git a/rubocop/cop/database/disable_referential_integrity.rb b/rubocop/cop/database/disable_referential_integrity.rb index 80d52678011..9e201e2d143 100644 --- a/rubocop/cop/database/disable_referential_integrity.rb +++ b/rubocop/cop/database/disable_referential_integrity.rb @@ -4,7 +4,7 @@ module RuboCop module Cop module Database # Cop that checks if 'disable_referential_integrity' method is called. - class DisableReferentialIntegrity < RuboCop::Cop::Cop + class DisableReferentialIntegrity < RuboCop::Cop::Base MSG = <<~TEXT Do not use `disable_referential_integrity`, disable triggers in a safe transaction instead. Follow the format: diff --git a/rubocop/cop/database/establish_connection.rb b/rubocop/cop/database/establish_connection.rb index 20454887ce2..3681974640b 100644 --- a/rubocop/cop/database/establish_connection.rb +++ b/rubocop/cop/database/establish_connection.rb @@ -3,7 +3,7 @@ module RuboCop module Cop module Database - class EstablishConnection < RuboCop::Cop::Cop + class EstablishConnection < RuboCop::Cop::Base MSG = "Don't establish new database connections, as this slows down " \ 'tests and may result in new connections using an incorrect configuration' @@ -12,7 +12,7 @@ module RuboCop PATTERN def on_send(node) - add_offense(node, location: :expression) if establish_connection?(node) + add_offense(node) if establish_connection?(node) end end end diff --git a/rubocop/cop/database/multiple_databases.rb b/rubocop/cop/database/multiple_databases.rb index 1ac9bb4473b..33ff8acd4d8 100644 --- a/rubocop/cop/database/multiple_databases.rb +++ b/rubocop/cop/database/multiple_databases.rb @@ -10,7 +10,7 @@ module RuboCop # # good # ApplicationRecord.connection # - class MultipleDatabases < RuboCop::Cop::Cop + class MultipleDatabases < RuboCop::Cop::Base AR_BASE_MESSAGE = <<~EOF Do not use methods from ActiveRecord::Base, use the ApplicationRecord class instead For fixing offenses related to the ActiveRecord::Base.transaction method, see our guidelines: @@ -32,7 +32,7 @@ module RuboCop active_record_base_method = node.children[1] return if method_is_allowed?(active_record_base_method) - add_offense(node, location: :expression, message: AR_BASE_MESSAGE) + add_offense(node, message: AR_BASE_MESSAGE) end private diff --git a/rubocop/cop/database/rescue_query_canceled.rb b/rubocop/cop/database/rescue_query_canceled.rb index 1238f9ed911..01f3ba272c2 100644 --- a/rubocop/cop/database/rescue_query_canceled.rb +++ b/rubocop/cop/database/rescue_query_canceled.rb @@ -20,7 +20,7 @@ module RuboCop # # good # # run_cheap_queries_with_each_batch - class RescueQueryCanceled < RuboCop::Cop::Cop + class RescueQueryCanceled < RuboCop::Cop::Base MSG = <<~EOF Avoid rescuing the `ActiveRecord::QueryCanceled` class. diff --git a/rubocop/cop/database/rescue_statement_timeout.rb b/rubocop/cop/database/rescue_statement_timeout.rb index 0b75a441e29..a0e9396e8f4 100644 --- a/rubocop/cop/database/rescue_statement_timeout.rb +++ b/rubocop/cop/database/rescue_statement_timeout.rb @@ -20,7 +20,7 @@ module RuboCop # # good # # run_cheap_queries_with_each_batch - class RescueStatementTimeout < RuboCop::Cop::Cop + class RescueStatementTimeout < RuboCop::Cop::Base MSG = <<~EOF Avoid rescuing the `ActiveRecord::StatementTimeout` class. |