Commit 500fa70b authored by alinamihaila's avatar alinamihaila

Removed method unused

parent 6353414d
......@@ -37,12 +37,6 @@ module RuboCop
$...)
PATTERN
def_node_matcher :non_related_class?, <<~PATTERN
(send
(const {nil? cbase} ${#non_related?})
$...)
PATTERN
def on_send(node)
one_level_matches = one_level_node(node)
two_level_matches = two_level_node(node)
......
......@@ -4,7 +4,6 @@ UsageData/LargeTable:
- 'lib/gitlab/usage_data.rb'
- 'ee/lib/ee/gitlab/usage_data.rb'
NonRelatedClasses:
- :EE::Gitlab::UsageData
- :Feature
- :Gitlab
- :Gitlab::AppLogger
......
......@@ -30,54 +30,54 @@ RSpec.describe RuboCop::Cop::UsageData::LargeTable, type: :rubocop do
end
context 'with large tables' do
context 'when counting' do
let(:source) do
<<~SRC
context 'when calling Issue.count' do
it 'register an offence' do
inspect_source <<~SRC
Issue.count
SRC
expect(cop.offenses.size).to eq(1)
end
end
let(:source_with_count_ancestor) do
<<~SRC
context 'when calling Issue.active.count' do
it 'register an offence' do
inspect_source <<~SRC
Issue.active.count
SRC
expect(cop.offenses.size).to eq(1)
end
end
let(:correct_source) do
<<~SRC
context 'when calling count(Issue)' do
it 'does not register an offence' do
inspect_source <<~SRC
count(Issue)
SRC
expect(cop.offenses).to be_empty
end
end
let(:correct_source_with_module) do
<<~SRC
context 'when calling count(Ci::Build.active)' do
it 'does not register an offence' do
inspect_source <<~SRC
count(Ci::Build.active)
SRC
expect(cop.offenses).to be_empty
end
end
let(:incorrect_source_with_module) do
<<~SRC
context 'when calling Ci::Build.active.count' do
it 'register an offence' do
inspect_source <<~SRC
Ci::Build.active.count
SRC
end
it 'registers an offence' do
inspect_source(source)
expect(cop.offenses.size).to eq(1)
end
it 'registers an offence with .count' do
inspect_source(source_with_count_ancestor)
expect(cop.offenses.size).to eq(1)
end
it 'does not register an offence' do
inspect_source(correct_source)
expect(cop.offenses).to be_empty
end
end
context 'when using allowed methods' do
......@@ -96,14 +96,10 @@ RSpec.describe RuboCop::Cop::UsageData::LargeTable, type: :rubocop do
end
context 'with non related class' do
let(:source) do
<<~SRC
it 'does not register an offence' do
inspect_source <<~SRC
Rails.count
SRC
end
it 'does not registers an offence' do
inspect_source(source)
expect(cop.offenses).to be_empty
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment