Commit 500fa70b authored by alinamihaila's avatar alinamihaila

Removed method unused

parent 6353414d
...@@ -37,12 +37,6 @@ module RuboCop ...@@ -37,12 +37,6 @@ module RuboCop
$...) $...)
PATTERN PATTERN
def_node_matcher :non_related_class?, <<~PATTERN
(send
(const {nil? cbase} ${#non_related?})
$...)
PATTERN
def on_send(node) def on_send(node)
one_level_matches = one_level_node(node) one_level_matches = one_level_node(node)
two_level_matches = two_level_node(node) two_level_matches = two_level_node(node)
......
...@@ -4,7 +4,6 @@ UsageData/LargeTable: ...@@ -4,7 +4,6 @@ UsageData/LargeTable:
- 'lib/gitlab/usage_data.rb' - 'lib/gitlab/usage_data.rb'
- 'ee/lib/ee/gitlab/usage_data.rb' - 'ee/lib/ee/gitlab/usage_data.rb'
NonRelatedClasses: NonRelatedClasses:
- :EE::Gitlab::UsageData
- :Feature - :Feature
- :Gitlab - :Gitlab
- :Gitlab::AppLogger - :Gitlab::AppLogger
......
...@@ -30,54 +30,54 @@ RSpec.describe RuboCop::Cop::UsageData::LargeTable, type: :rubocop do ...@@ -30,54 +30,54 @@ RSpec.describe RuboCop::Cop::UsageData::LargeTable, type: :rubocop do
end end
context 'with large tables' do context 'with large tables' do
context 'when counting' do context 'when calling Issue.count' do
let(:source) do it 'register an offence' do
<<~SRC inspect_source <<~SRC
Issue.count Issue.count
SRC SRC
expect(cop.offenses.size).to eq(1)
end end
end
let(:source_with_count_ancestor) do context 'when calling Issue.active.count' do
<<~SRC it 'register an offence' do
inspect_source <<~SRC
Issue.active.count Issue.active.count
SRC SRC
expect(cop.offenses.size).to eq(1)
end end
end
let(:correct_source) do context 'when calling count(Issue)' do
<<~SRC it 'does not register an offence' do
inspect_source <<~SRC
count(Issue) count(Issue)
SRC SRC
expect(cop.offenses).to be_empty
end end
end
let(:correct_source_with_module) do context 'when calling count(Ci::Build.active)' do
<<~SRC it 'does not register an offence' do
inspect_source <<~SRC
count(Ci::Build.active) count(Ci::Build.active)
SRC SRC
expect(cop.offenses).to be_empty
end end
end
let(:incorrect_source_with_module) do context 'when calling Ci::Build.active.count' do
<<~SRC it 'register an offence' do
inspect_source <<~SRC
Ci::Build.active.count Ci::Build.active.count
SRC SRC
end
it 'registers an offence' do
inspect_source(source)
expect(cop.offenses.size).to eq(1) expect(cop.offenses.size).to eq(1)
end 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 end
context 'when using allowed methods' do context 'when using allowed methods' do
...@@ -96,14 +96,10 @@ RSpec.describe RuboCop::Cop::UsageData::LargeTable, type: :rubocop do ...@@ -96,14 +96,10 @@ RSpec.describe RuboCop::Cop::UsageData::LargeTable, type: :rubocop do
end end
context 'with non related class' do context 'with non related class' do
let(:source) do it 'does not register an offence' do
<<~SRC inspect_source <<~SRC
Rails.count Rails.count
SRC SRC
end
it 'does not registers an offence' do
inspect_source(source)
expect(cop.offenses).to be_empty expect(cop.offenses).to be_empty
end 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