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
01d8c1f6
Commit
01d8c1f6
authored
Oct 31, 2018
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Whitelist none method from ActiveRecord::Querying
parent
fc892db6
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
0 additions
and
31 deletions
+0
-31
app/finders/autocomplete/users_finder.rb
app/finders/autocomplete/users_finder.rb
+0
-2
app/finders/concerns/finder_with_cross_project_access.rb
app/finders/concerns/finder_with_cross_project_access.rb
+0
-2
app/finders/group_descendants_finder.rb
app/finders/group_descendants_finder.rb
+0
-2
app/finders/groups_finder.rb
app/finders/groups_finder.rb
+0
-4
app/finders/issuable_finder.rb
app/finders/issuable_finder.rb
+0
-4
app/finders/issues_finder.rb
app/finders/issues_finder.rb
+0
-2
app/finders/labels_finder.rb
app/finders/labels_finder.rb
+0
-2
app/finders/milestones_finder.rb
app/finders/milestones_finder.rb
+0
-2
app/finders/pipelines_finder.rb
app/finders/pipelines_finder.rb
+0
-2
app/finders/projects_finder.rb
app/finders/projects_finder.rb
+0
-2
app/finders/snippets_finder.rb
app/finders/snippets_finder.rb
+0
-2
app/services/search/group_service.rb
app/services/search/group_service.rb
+0
-2
lib/gitlab/user_extractor.rb
lib/gitlab/user_extractor.rb
+0
-2
rubocop/cop/code_reuse/active_record.rb
rubocop/cop/code_reuse/active_record.rb
+0
-1
No files found.
app/finders/autocomplete/users_finder.rb
View file @
01d8c1f6
...
@@ -72,7 +72,6 @@ module Autocomplete
...
@@ -72,7 +72,6 @@ module Autocomplete
author_id
.
present?
&&
current_user
author_id
.
present?
&&
current_user
end
end
# rubocop: disable CodeReuse/ActiveRecord
def
find_users
def
find_users
if
project
if
project
project
.
authorized_users
.
union_with_user
(
author_id
)
project
.
authorized_users
.
union_with_user
(
author_id
)
...
@@ -84,6 +83,5 @@ module Autocomplete
...
@@ -84,6 +83,5 @@ module Autocomplete
User
.
none
User
.
none
end
end
end
end
# rubocop: enable CodeReuse/ActiveRecord
end
end
end
end
app/finders/concerns/finder_with_cross_project_access.rb
View file @
01d8c1f6
...
@@ -16,7 +16,6 @@ module FinderWithCrossProjectAccess
...
@@ -16,7 +16,6 @@ module FinderWithCrossProjectAccess
end
end
override
:execute
override
:execute
# rubocop: disable CodeReuse/ActiveRecord
def
execute
(
*
args
)
def
execute
(
*
args
)
check
=
Gitlab
::
CrossProjectAccess
.
find_check
(
self
)
check
=
Gitlab
::
CrossProjectAccess
.
find_check
(
self
)
original
=
super
original
=
super
...
@@ -30,7 +29,6 @@ module FinderWithCrossProjectAccess
...
@@ -30,7 +29,6 @@ module FinderWithCrossProjectAccess
original
original
end
end
end
end
# rubocop: enable CodeReuse/ActiveRecord
# We can skip the cross project check for finding indivitual records.
# We can skip the cross project check for finding indivitual records.
# this would be handled by the `can?(:read_*, result)` call in `FinderMethods`
# this would be handled by the `can?(:read_*, result)` call in `FinderMethods`
...
...
app/finders/group_descendants_finder.rb
View file @
01d8c1f6
...
@@ -131,7 +131,6 @@ class GroupDescendantsFinder
...
@@ -131,7 +131,6 @@ class GroupDescendantsFinder
.
with_selects_for_list
(
archived:
params
[
:archived
])
.
with_selects_for_list
(
archived:
params
[
:archived
])
end
end
# rubocop: disable CodeReuse/ActiveRecord
def
subgroups
def
subgroups
return
Group
.
none
unless
Group
.
supports_nested_groups?
return
Group
.
none
unless
Group
.
supports_nested_groups?
...
@@ -145,7 +144,6 @@ class GroupDescendantsFinder
...
@@ -145,7 +144,6 @@ class GroupDescendantsFinder
groups
.
with_selects_for_list
(
archived:
params
[
:archived
]).
order_by
(
sort
)
groups
.
with_selects_for_list
(
archived:
params
[
:archived
]).
order_by
(
sort
)
end
end
# rubocop: enable CodeReuse/ActiveRecord
# rubocop: disable CodeReuse/Finder
# rubocop: disable CodeReuse/Finder
def
direct_child_projects
def
direct_child_projects
...
...
app/finders/groups_finder.rb
View file @
01d8c1f6
...
@@ -40,7 +40,6 @@ class GroupsFinder < UnionFinder
...
@@ -40,7 +40,6 @@ class GroupsFinder < UnionFinder
attr_reader
:current_user
,
:params
attr_reader
:current_user
,
:params
# rubocop: disable CodeReuse/ActiveRecord
def
all_groups
def
all_groups
return
[
owned_groups
]
if
params
[
:owned
]
return
[
owned_groups
]
if
params
[
:owned
]
return
[
groups_with_min_access_level
]
if
min_access_level?
return
[
groups_with_min_access_level
]
if
min_access_level?
...
@@ -52,7 +51,6 @@ class GroupsFinder < UnionFinder
...
@@ -52,7 +51,6 @@ class GroupsFinder < UnionFinder
groups
<<
Group
.
none
if
groups
.
empty?
groups
<<
Group
.
none
if
groups
.
empty?
groups
groups
end
end
# rubocop: enable CodeReuse/ActiveRecord
def
groups_for_ancestors
def
groups_for_ancestors
current_user
.
authorized_groups
current_user
.
authorized_groups
...
@@ -82,11 +80,9 @@ class GroupsFinder < UnionFinder
...
@@ -82,11 +80,9 @@ class GroupsFinder < UnionFinder
end
end
# rubocop: enable CodeReuse/ActiveRecord
# rubocop: enable CodeReuse/ActiveRecord
# rubocop: disable CodeReuse/ActiveRecord
def
owned_groups
def
owned_groups
current_user
&
.
owned_groups
||
Group
.
none
current_user
&
.
owned_groups
||
Group
.
none
end
end
# rubocop: enable CodeReuse/ActiveRecord
def
include_public_groups?
def
include_public_groups?
current_user
.
nil?
||
all_available?
current_user
.
nil?
||
all_available?
...
...
app/finders/issuable_finder.rb
View file @
01d8c1f6
...
@@ -196,7 +196,6 @@ class IssuableFinder
...
@@ -196,7 +196,6 @@ class IssuableFinder
milestones?
&&
params
[
:milestone_title
]
==
Milestone
::
None
.
title
milestones?
&&
params
[
:milestone_title
]
==
Milestone
::
None
.
title
end
end
# rubocop: disable CodeReuse/ActiveRecord
def
milestones
def
milestones
return
@milestones
if
defined?
(
@milestones
)
return
@milestones
if
defined?
(
@milestones
)
...
@@ -217,7 +216,6 @@ class IssuableFinder
...
@@ -217,7 +216,6 @@ class IssuableFinder
Milestone
.
none
Milestone
.
none
end
end
end
end
# rubocop: enable CodeReuse/ActiveRecord
def
labels?
def
labels?
params
[
:label_name
].
present?
params
[
:label_name
].
present?
...
@@ -227,7 +225,6 @@ class IssuableFinder
...
@@ -227,7 +225,6 @@ class IssuableFinder
labels?
&&
params
[
:label_name
].
include?
(
Label
::
None
.
title
)
labels?
&&
params
[
:label_name
].
include?
(
Label
::
None
.
title
)
end
end
# rubocop: disable CodeReuse/ActiveRecord
def
labels
def
labels
return
@labels
if
defined?
(
@labels
)
return
@labels
if
defined?
(
@labels
)
...
@@ -238,7 +235,6 @@ class IssuableFinder
...
@@ -238,7 +235,6 @@ class IssuableFinder
Label
.
none
Label
.
none
end
end
end
end
# rubocop: enable CodeReuse/ActiveRecord
def
assignee_id?
def
assignee_id?
params
[
:assignee_id
].
present?
params
[
:assignee_id
].
present?
...
...
app/finders/issues_finder.rb
View file @
01d8c1f6
...
@@ -135,7 +135,6 @@ class IssuesFinder < IssuableFinder
...
@@ -135,7 +135,6 @@ class IssuesFinder < IssuableFinder
current_user
.
blank?
current_user
.
blank?
end
end
# rubocop: disable CodeReuse/ActiveRecord
def
by_assignee
(
items
)
def
by_assignee
(
items
)
if
filter_by_no_assignee?
if
filter_by_no_assignee?
items
.
unassigned
items
.
unassigned
...
@@ -149,5 +148,4 @@ class IssuesFinder < IssuableFinder
...
@@ -149,5 +148,4 @@ class IssuesFinder < IssuableFinder
items
items
end
end
end
end
# rubocop: enable CodeReuse/ActiveRecord
end
end
app/finders/labels_finder.rb
View file @
01d8c1f6
...
@@ -12,7 +12,6 @@ class LabelsFinder < UnionFinder
...
@@ -12,7 +12,6 @@ class LabelsFinder < UnionFinder
@params
=
params
@params
=
params
end
end
# rubocop: disable CodeReuse/ActiveRecord
def
execute
(
skip_authorization:
false
)
def
execute
(
skip_authorization:
false
)
@skip_authorization
=
skip_authorization
@skip_authorization
=
skip_authorization
items
=
find_union
(
label_ids
,
Label
)
||
Label
.
none
items
=
find_union
(
label_ids
,
Label
)
||
Label
.
none
...
@@ -21,7 +20,6 @@ class LabelsFinder < UnionFinder
...
@@ -21,7 +20,6 @@ class LabelsFinder < UnionFinder
items
=
by_search
(
items
)
items
=
by_search
(
items
)
sort
(
items
)
sort
(
items
)
end
end
# rubocop: enable CodeReuse/ActiveRecord
private
private
...
...
app/finders/milestones_finder.rb
View file @
01d8c1f6
...
@@ -20,7 +20,6 @@ class MilestonesFinder
...
@@ -20,7 +20,6 @@ class MilestonesFinder
@params
=
params
@params
=
params
end
end
# rubocop: disable CodeReuse/ActiveRecord
def
execute
def
execute
return
Milestone
.
none
if
project_ids
.
empty?
&&
group_ids
.
empty?
return
Milestone
.
none
if
project_ids
.
empty?
&&
group_ids
.
empty?
...
@@ -31,7 +30,6 @@ class MilestonesFinder
...
@@ -31,7 +30,6 @@ class MilestonesFinder
order
(
items
)
order
(
items
)
end
end
# rubocop: enable CodeReuse/ActiveRecord
private
private
...
...
app/finders/pipelines_finder.rb
View file @
01d8c1f6
...
@@ -12,7 +12,6 @@ class PipelinesFinder
...
@@ -12,7 +12,6 @@ class PipelinesFinder
@params
=
params
@params
=
params
end
end
# rubocop: disable CodeReuse/ActiveRecord
def
execute
def
execute
unless
Ability
.
allowed?
(
current_user
,
:read_pipeline
,
project
)
unless
Ability
.
allowed?
(
current_user
,
:read_pipeline
,
project
)
return
Ci
::
Pipeline
.
none
return
Ci
::
Pipeline
.
none
...
@@ -28,7 +27,6 @@ class PipelinesFinder
...
@@ -28,7 +27,6 @@ class PipelinesFinder
items
=
by_yaml_errors
(
items
)
items
=
by_yaml_errors
(
items
)
sort_items
(
items
)
sort_items
(
items
)
end
end
# rubocop: enable CodeReuse/ActiveRecord
private
private
...
...
app/finders/projects_finder.rb
View file @
01d8c1f6
...
@@ -88,7 +88,6 @@ class ProjectsFinder < UnionFinder
...
@@ -88,7 +88,6 @@ class ProjectsFinder < UnionFinder
# rubocop: enable CodeReuse/ActiveRecord
# rubocop: enable CodeReuse/ActiveRecord
# Builds a collection for an anonymous user.
# Builds a collection for an anonymous user.
# rubocop: disable CodeReuse/ActiveRecord
def
collection_without_user
def
collection_without_user
if
private_only?
||
owned_projects?
||
min_access_level?
if
private_only?
||
owned_projects?
||
min_access_level?
Project
.
none
Project
.
none
...
@@ -96,7 +95,6 @@ class ProjectsFinder < UnionFinder
...
@@ -96,7 +95,6 @@ class ProjectsFinder < UnionFinder
Project
.
public_to_user
Project
.
public_to_user
end
end
end
end
# rubocop: enable CodeReuse/ActiveRecord
def
owned_projects?
def
owned_projects?
params
[
:owned
].
present?
params
[
:owned
].
present?
...
...
app/finders/snippets_finder.rb
View file @
01d8c1f6
...
@@ -43,7 +43,6 @@ class SnippetsFinder < UnionFinder
...
@@ -43,7 +43,6 @@ class SnippetsFinder < UnionFinder
end
end
end
end
# rubocop: disable CodeReuse/ActiveRecord
def
authorized_snippets_from_project
def
authorized_snippets_from_project
if
can?
(
current_user
,
:read_project_snippet
,
project
)
if
can?
(
current_user
,
:read_project_snippet
,
project
)
if
project
.
team
.
member?
(
current_user
)
if
project
.
team
.
member?
(
current_user
)
...
@@ -55,7 +54,6 @@ class SnippetsFinder < UnionFinder
...
@@ -55,7 +54,6 @@ class SnippetsFinder < UnionFinder
Snippet
.
none
Snippet
.
none
end
end
end
end
# rubocop: enable CodeReuse/ActiveRecord
# rubocop: disable CodeReuse/ActiveRecord
# rubocop: disable CodeReuse/ActiveRecord
def
authorized_snippets
def
authorized_snippets
...
...
app/services/search/group_service.rb
View file @
01d8c1f6
...
@@ -11,13 +11,11 @@ module Search
...
@@ -11,13 +11,11 @@ module Search
@group
=
group
@group
=
group
end
end
# rubocop: disable CodeReuse/ActiveRecord
def
projects
def
projects
return
Project
.
none
unless
group
return
Project
.
none
unless
group
return
@projects
if
defined?
@projects
return
@projects
if
defined?
@projects
@projects
=
super
.
inside_path
(
group
.
full_path
)
@projects
=
super
.
inside_path
(
group
.
full_path
)
end
end
# rubocop: enable CodeReuse/ActiveRecord
end
end
end
end
lib/gitlab/user_extractor.rb
View file @
01d8c1f6
...
@@ -14,13 +14,11 @@ module Gitlab
...
@@ -14,13 +14,11 @@ module Gitlab
@text
=
text
@text
=
text
end
end
# rubocop: disable CodeReuse/ActiveRecord
def
users
def
users
return
User
.
none
unless
@text
.
present?
return
User
.
none
unless
@text
.
present?
@users
||=
User
.
from_union
(
union_relations
)
@users
||=
User
.
from_union
(
union_relations
)
end
end
# rubocop: enable CodeReuse/ActiveRecord
def
usernames
def
usernames
matches
[
:usernames
]
matches
[
:usernames
]
...
...
rubocop/cop/code_reuse/active_record.rb
View file @
01d8c1f6
...
@@ -49,7 +49,6 @@ module RuboCop
...
@@ -49,7 +49,6 @@ module RuboCop
limit:
true
,
limit:
true
,
lock:
false
,
lock:
false
,
many?:
false
,
many?:
false
,
none:
false
,
offset:
true
,
offset:
true
,
order:
true
,
order:
true
,
pluck:
true
,
pluck:
true
,
...
...
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