Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
500fa70b
Commit
500fa70b
authored
Jul 24, 2020
by
alinamihaila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed method unused
parent
6353414d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
40 deletions
+29
-40
rubocop/cop/usage_data/large_table.rb
rubocop/cop/usage_data/large_table.rb
+0
-6
rubocop/rubocop-usage-data.yml
rubocop/rubocop-usage-data.yml
+0
-1
spec/rubocop/cop/usage_data/large_table_spec.rb
spec/rubocop/cop/usage_data/large_table_spec.rb
+29
-33
No files found.
rubocop/cop/usage_data/large_table.rb
View file @
500fa70b
...
...
@@ -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
)
...
...
rubocop/rubocop-usage-data.yml
View file @
500fa70b
...
...
@@ -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
...
...
spec/rubocop/cop/usage_data/large_table_spec.rb
View file @
500fa70b
...
...
@@ -30,54 +30,54 @@ RSpec.describe RuboCop::Cop::UsageData::LargeTable, type: :rubocop do
end
context
'with large tables'
do
context
'when c
ounting
'
do
let
(
:source
)
do
<<~
SRC
context
'when c
alling 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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment