Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'rubocop/cop/performance/ar_count_each.rb')
-rw-r--r--rubocop/cop/performance/ar_count_each.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/rubocop/cop/performance/ar_count_each.rb b/rubocop/cop/performance/ar_count_each.rb
index 2fe8e549872..1dae473d87d 100644
--- a/rubocop/cop/performance/ar_count_each.rb
+++ b/rubocop/cop/performance/ar_count_each.rb
@@ -3,7 +3,7 @@
module RuboCop
module Cop
module Performance
- class ARCountEach < RuboCop::Cop::Cop
+ class ARCountEach < RuboCop::Cop::Base
def message(ivar)
"If #{ivar} is AR relation, avoid `#{ivar}.count ...; #{ivar}.each... `, this will trigger two queries. " \
"Use `#{ivar}.load.size ...; #{ivar}.each... ` instead. If #{ivar} is an array, try to use #{ivar}.size."
@@ -35,7 +35,7 @@ module RuboCop
begin_node.each_descendant do |n|
ivar_each = each_match(n)
- add_offense(node, location: :expression, message: message(ivar_count)) if ivar_each == ivar_count
+ add_offense(node, message: message(ivar_count)) if ivar_each == ivar_count
end
end
end