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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
75f5fa99
Commit
75f5fa99
authored
Feb 22, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable Rails/Delegate
parent
7d4b52b2
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
39 additions
and
110 deletions
+39
-110
.rubocop.yml
.rubocop.yml
+1
-1
app/helpers/application_settings_helper.rb
app/helpers/application_settings_helper.rb
+6
-19
app/helpers/visibility_level_helper.rb
app/helpers/visibility_level_helper.rb
+3
-7
app/models/ci/build.rb
app/models/ci/build.rb
+1
-3
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+1
-3
app/models/project.rb
app/models/project.rb
+2
-6
app/models/project_wiki.rb
app/models/project_wiki.rb
+2
-6
app/models/repository.rb
app/models/repository.rb
+2
-6
app/policies/base_policy.rb
app/policies/base_policy.rb
+1
-3
app/services/base_service.rb
app/services/base_service.rb
+1
-3
app/services/ci/create_pipeline_builds_service.rb
app/services/ci/create_pipeline_builds_service.rb
+1
-3
app/views/layouts/nav/_admin.html.haml
app/views/layouts/nav/_admin.html.haml
+1
-1
lib/bitbucket/connection.rb
lib/bitbucket/connection.rb
+1
-3
lib/gitlab/access.rb
lib/gitlab/access.rb
+1
-3
lib/gitlab/ci/build/artifacts/metadata/entry.rb
lib/gitlab/ci/build/artifacts/metadata/entry.rb
+1
-3
lib/gitlab/current_settings.rb
lib/gitlab/current_settings.rb
+1
-3
lib/gitlab/git/commit.rb
lib/gitlab/git/commit.rb
+1
-3
lib/gitlab/git/repository.rb
lib/gitlab/git/repository.rb
+4
-10
lib/gitlab/github_import/issuable_formatter.rb
lib/gitlab/github_import/issuable_formatter.rb
+1
-3
lib/gitlab/ldap/person.rb
lib/gitlab/ldap/person.rb
+1
-3
lib/gitlab/redis.rb
lib/gitlab/redis.rb
+2
-6
lib/gitlab/visibility_level.rb
lib/gitlab/visibility_level.rb
+1
-3
spec/lib/gitlab/utils_spec.rb
spec/lib/gitlab/utils_spec.rb
+1
-3
spec/models/user_spec.rb
spec/models/user_spec.rb
+1
-3
spec/services/ci/process_pipeline_service_spec.rb
spec/services/ci/process_pipeline_service_spec.rb
+1
-3
No files found.
.rubocop.yml
View file @
75f5fa99
...
@@ -763,7 +763,7 @@ Rails/Date:
...
@@ -763,7 +763,7 @@ Rails/Date:
# Prefer delegate method for delegations.
# Prefer delegate method for delegations.
Rails/Delegate
:
Rails/Delegate
:
Enabled
:
fals
e
Enabled
:
tru
e
# Prefer `find_by` over `where.first`.
# Prefer `find_by` over `where.first`.
Rails/FindBy
:
Rails/FindBy
:
...
...
app/helpers/application_settings_helper.rb
View file @
75f5fa99
module
ApplicationSettingsHelper
module
ApplicationSettingsHelper
def
gravatar_enabled?
delegate
:gravatar_enabled?
,
current_application_settings
.
gravatar_enabled?
:signup_enabled?
,
end
:signin_enabled?
,
:akismet_enabled?
,
def
signup_enabled?
:koding_enabled?
,
current_application_settings
.
signup_enabled?
to: :current_application_settings
end
def
signin_enabled?
current_application_settings
.
signin_enabled?
end
def
user_oauth_applications?
def
user_oauth_applications?
current_application_settings
.
user_oauth_applications
current_application_settings
.
user_oauth_applications
end
end
def
askimet_enabled?
current_application_settings
.
akismet_enabled?
end
def
koding_enabled?
current_application_settings
.
koding_enabled?
end
def
allowed_protocols_present?
def
allowed_protocols_present?
current_application_settings
.
enabled_git_access_protocol
.
present?
current_application_settings
.
enabled_git_access_protocol
.
present?
end
end
...
...
app/helpers/visibility_level_helper.rb
View file @
75f5fa99
...
@@ -89,13 +89,9 @@ module VisibilityLevelHelper
...
@@ -89,13 +89,9 @@ module VisibilityLevelHelper
current_application_settings
.
restricted_visibility_levels
||
[]
current_application_settings
.
restricted_visibility_levels
||
[]
end
end
def
default_project_visibility
delegate
:default_project_visibility
,
current_application_settings
.
default_project_visibility
:default_group_visibility
,
end
to: :current_application_settings
def
default_group_visibility
current_application_settings
.
default_group_visibility
end
def
skip_level?
(
form_model
,
level
)
def
skip_level?
(
form_model
,
level
)
form_model
.
is_a?
(
Project
)
&&
!
form_model
.
visibility_level_allowed?
(
level
)
form_model
.
is_a?
(
Project
)
&&
!
form_model
.
visibility_level_allowed?
(
level
)
...
...
app/models/ci/build.rb
View file @
75f5fa99
...
@@ -233,9 +233,7 @@ module Ci
...
@@ -233,9 +233,7 @@ module Ci
gl_project_id
gl_project_id
end
end
def
project_name
delegate
:name
,
to: :project
,
prefix:
true
project
.
name
end
def
repo_url
def
repo_url
auth
=
"gitlab-ci-token:
#{
ensure_token!
}
@"
auth
=
"gitlab-ci-token:
#{
ensure_token!
}
@"
...
...
app/models/ci/pipeline.rb
View file @
75f5fa99
...
@@ -153,9 +153,7 @@ module Ci
...
@@ -153,9 +153,7 @@ module Ci
builds
.
latest
.
with_artifacts_not_expired
.
includes
(
project:
[
:namespace
])
builds
.
latest
.
with_artifacts_not_expired
.
includes
(
project:
[
:namespace
])
end
end
def
project_id
delegate
:id
,
to: :project
,
prefix:
true
project
.
id
end
# For now the only user who participates is the user who triggered
# For now the only user who participates is the user who triggered
def
participants
(
_current_user
=
nil
)
def
participants
(
_current_user
=
nil
)
...
...
app/models/project.rb
View file @
75f5fa99
...
@@ -838,9 +838,7 @@ class Project < ActiveRecord::Base
...
@@ -838,9 +838,7 @@ class Project < ActiveRecord::Base
false
false
end
end
def
empty_repo?
delegate
:empty_repo?
,
to: :repository
repository
.
empty_repo?
end
def
repo
def
repo
repository
.
raw
repository
.
raw
...
@@ -1029,9 +1027,7 @@ class Project < ActiveRecord::Base
...
@@ -1029,9 +1027,7 @@ class Project < ActiveRecord::Base
forked?
&&
project
==
forked_from_project
forked?
&&
project
==
forked_from_project
end
end
def
forks_count
delegate
:count
,
to: :forks
,
prefix:
true
forks
.
count
end
def
origin_merge_requests
def
origin_merge_requests
merge_requests
.
where
(
source_project_id:
self
.
id
)
merge_requests
.
where
(
source_project_id:
self
.
id
)
...
...
app/models/project_wiki.rb
View file @
75f5fa99
...
@@ -60,9 +60,7 @@ class ProjectWiki
...
@@ -60,9 +60,7 @@ class ProjectWiki
!!
repository
.
exists?
!!
repository
.
exists?
end
end
def
empty?
delegate
:empty?
,
to: :pages
pages
.
empty?
end
# Returns an Array of Gitlab WikiPage instances or an
# Returns an Array of Gitlab WikiPage instances or an
# empty Array if this Wiki has no pages.
# empty Array if this Wiki has no pages.
...
@@ -160,9 +158,7 @@ class ProjectWiki
...
@@ -160,9 +158,7 @@ class ProjectWiki
}
}
end
end
def
repository_storage_path
delegate
:repository_storage_path
,
to: :project
project
.
repository_storage_path
end
private
private
...
...
app/models/repository.rb
View file @
75f5fa99
...
@@ -487,9 +487,7 @@ class Repository
...
@@ -487,9 +487,7 @@ class Repository
end
end
cache_method
:exists?
cache_method
:exists?
def
empty?
delegate
:empty?
,
to: :raw_repository
raw_repository
.
empty?
end
cache_method
:empty?
cache_method
:empty?
# The size of this repository in megabytes.
# The size of this repository in megabytes.
...
@@ -508,9 +506,7 @@ class Repository
...
@@ -508,9 +506,7 @@ class Repository
end
end
cache_method
:branch_names
,
fallback:
[]
cache_method
:branch_names
,
fallback:
[]
def
tag_names
delegate
:tag_names
,
to: :raw_repository
raw_repository
.
tag_names
end
cache_method
:tag_names
,
fallback:
[]
cache_method
:tag_names
,
fallback:
[]
def
branch_count
def
branch_count
...
...
app/policies/base_policy.rb
View file @
75f5fa99
...
@@ -6,9 +6,7 @@ class BasePolicy
...
@@ -6,9 +6,7 @@ class BasePolicy
@cannot_set
=
cannot_set
@cannot_set
=
cannot_set
end
end
def
size
delegate
:size
,
to: :to_set
to_set
.
size
end
def
self
.
empty
def
self
.
empty
new
(
Set
.
new
,
Set
.
new
)
new
(
Set
.
new
,
Set
.
new
)
...
...
app/services/base_service.rb
View file @
75f5fa99
...
@@ -28,9 +28,7 @@ class BaseService
...
@@ -28,9 +28,7 @@ class BaseService
SystemHooksService
.
new
SystemHooksService
.
new
end
end
def
repository
delegate
:repository
,
to: :project
project
.
repository
end
# Add an error to the specified model for restricted visibility levels
# Add an error to the specified model for restricted visibility levels
def
deny_visibility_level
(
model
,
denied_visibility_level
=
nil
)
def
deny_visibility_level
(
model
,
denied_visibility_level
=
nil
)
...
...
app/services/ci/create_pipeline_builds_service.rb
View file @
75f5fa99
...
@@ -10,9 +10,7 @@ module Ci
...
@@ -10,9 +10,7 @@ module Ci
end
end
end
end
def
project
delegate
:project
,
to: :pipeline
pipeline
.
project
end
private
private
...
...
app/views/layouts/nav/_admin.html.haml
View file @
75f5fa99
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
Abuse Reports
Abuse Reports
%span
.badge.count
=
number_with_delimiter
(
AbuseReport
.
count
(
:all
))
%span
.badge.count
=
number_with_delimiter
(
AbuseReport
.
count
(
:all
))
-
if
a
ski
met_enabled?
-
if
a
kis
met_enabled?
=
nav_link
(
controller: :spam_logs
)
do
=
nav_link
(
controller: :spam_logs
)
do
=
link_to
admin_spam_logs_path
,
title:
"Spam Logs"
do
=
link_to
admin_spam_logs_path
,
title:
"Spam Logs"
do
%span
%span
...
...
lib/bitbucket/connection.rb
View file @
75f5fa99
...
@@ -24,9 +24,7 @@ module Bitbucket
...
@@ -24,9 +24,7 @@ module Bitbucket
response
.
parsed
response
.
parsed
end
end
def
expired?
delegate
:expired?
,
to: :connection
connection
.
expired?
end
def
refresh!
def
refresh!
response
=
connection
.
refresh!
response
=
connection
.
refresh!
...
...
lib/gitlab/access.rb
View file @
75f5fa99
...
@@ -21,9 +21,7 @@ module Gitlab
...
@@ -21,9 +21,7 @@ module Gitlab
PROTECTION_DEV_CAN_MERGE
=
3
PROTECTION_DEV_CAN_MERGE
=
3
class
<<
self
class
<<
self
def
values
delegate
:values
,
to: :options
options
.
values
end
def
all_values
def
all_values
options_with_owner
.
values
options_with_owner
.
values
...
...
lib/gitlab/ci/build/artifacts/metadata/entry.rb
View file @
75f5fa99
...
@@ -91,9 +91,7 @@ module Gitlab
...
@@ -91,9 +91,7 @@ module Gitlab
blank_node?
||
@entries
.
include?
(
@path
)
blank_node?
||
@entries
.
include?
(
@path
)
end
end
def
empty?
delegate
:empty?
,
to: :children
children
.
empty?
end
def
total_size
def
total_size
descendant_pattern
=
%r{^
#{
Regexp
.
escape
(
@path
)
}
}
descendant_pattern
=
%r{^
#{
Regexp
.
escape
(
@path
)
}
}
...
...
lib/gitlab/current_settings.rb
View file @
75f5fa99
...
@@ -25,9 +25,7 @@ module Gitlab
...
@@ -25,9 +25,7 @@ module Gitlab
settings
||
in_memory_application_settings
settings
||
in_memory_application_settings
end
end
def
sidekiq_throttling_enabled?
delegate
:sidekiq_throttling_enabled?
,
to: :current_application_settings
current_application_settings
.
sidekiq_throttling_enabled?
end
def
in_memory_application_settings
def
in_memory_application_settings
@in_memory_application_settings
||=
::
ApplicationSetting
.
new
(
::
ApplicationSetting
.
defaults
)
@in_memory_application_settings
||=
::
ApplicationSetting
.
new
(
::
ApplicationSetting
.
defaults
)
...
...
lib/gitlab/git/commit.rb
View file @
75f5fa99
...
@@ -218,9 +218,7 @@ module Gitlab
...
@@ -218,9 +218,7 @@ module Gitlab
raw_commit
.
parents
.
map
{
|
c
|
Gitlab
::
Git
::
Commit
.
new
(
c
)
}
raw_commit
.
parents
.
map
{
|
c
|
Gitlab
::
Git
::
Commit
.
new
(
c
)
}
end
end
def
tree
delegate
:tree
,
to: :raw_commit
raw_commit
.
tree
end
def
stats
def
stats
Gitlab
::
Git
::
CommitStats
.
new
(
self
)
Gitlab
::
Git
::
CommitStats
.
new
(
self
)
...
...
lib/gitlab/git/repository.rb
View file @
75f5fa99
...
@@ -162,13 +162,9 @@ module Gitlab
...
@@ -162,13 +162,9 @@ module Gitlab
!
empty?
!
empty?
end
end
def
empty?
delegate
:empty?
,
rugged
.
empty?
:bare?
,
end
to: :rugged
def
bare?
rugged
.
bare?
end
def
repo_exists?
def
repo_exists?
!!
rugged
!!
rugged
...
@@ -565,9 +561,7 @@ module Gitlab
...
@@ -565,9 +561,7 @@ module Gitlab
# will trigger a +:mixed+ reset and the working directory will be
# will trigger a +:mixed+ reset and the working directory will be
# replaced with the content of the index. (Untracked and ignored files
# replaced with the content of the index. (Untracked and ignored files
# will be left alone)
# will be left alone)
def
reset
(
ref
,
reset_type
)
delegate
:reset
,
to: :rugged
rugged
.
reset
(
ref
,
reset_type
)
end
# Mimic the `git clean` command and recursively delete untracked files.
# Mimic the `git clean` command and recursively delete untracked files.
# Valid keys that can be passed in the +options+ hash are:
# Valid keys that can be passed in the +options+ hash are:
...
...
lib/gitlab/github_import/issuable_formatter.rb
View file @
75f5fa99
...
@@ -7,9 +7,7 @@ module Gitlab
...
@@ -7,9 +7,7 @@ module Gitlab
raise
NotImplementedError
raise
NotImplementedError
end
end
def
number
delegate
:number
,
to: :raw_data
raw_data
.
number
end
def
find_condition
def
find_condition
{
iid:
number
}
{
iid:
number
}
...
...
lib/gitlab/ldap/person.rb
View file @
75f5fa99
...
@@ -43,9 +43,7 @@ module Gitlab
...
@@ -43,9 +43,7 @@ module Gitlab
attribute_value
(
:email
)
attribute_value
(
:email
)
end
end
def
dn
delegate
:dn
,
to: :entry
entry
.
dn
end
private
private
...
...
lib/gitlab/redis.rb
View file @
75f5fa99
...
@@ -13,15 +13,11 @@ module Gitlab
...
@@ -13,15 +13,11 @@ module Gitlab
class
<<
self
class
<<
self
# Do NOT cache in an instance variable. Result may be mutated by caller.
# Do NOT cache in an instance variable. Result may be mutated by caller.
def
params
delegate
:params
,
to: :new
new
.
params
end
# Do NOT cache in an instance variable. Result may be mutated by caller.
# Do NOT cache in an instance variable. Result may be mutated by caller.
# @deprecated Use .params instead to get sentinel support
# @deprecated Use .params instead to get sentinel support
def
url
delegate
:url
,
to: :new
new
.
url
end
def
with
def
with
@pool
||=
ConnectionPool
.
new
(
size:
pool_size
)
{
::
Redis
.
new
(
params
)
}
@pool
||=
ConnectionPool
.
new
(
size:
pool_size
)
{
::
Redis
.
new
(
params
)
}
...
...
lib/gitlab/visibility_level.rb
View file @
75f5fa99
...
@@ -33,9 +33,7 @@ module Gitlab
...
@@ -33,9 +33,7 @@ module Gitlab
PUBLIC
=
20
unless
const_defined?
(
:PUBLIC
)
PUBLIC
=
20
unless
const_defined?
(
:PUBLIC
)
class
<<
self
class
<<
self
def
values
delegate
:values
,
to: :options
options
.
values
end
def
options
def
options
{
{
...
...
spec/lib/gitlab/utils_spec.rb
View file @
75f5fa99
describe
Gitlab
::
Utils
,
lib:
true
do
describe
Gitlab
::
Utils
,
lib:
true
do
def
to_boolean
(
value
)
delegate
:to_boolean
,
to: :described_class
described_class
.
to_boolean
(
value
)
end
describe
'.to_boolean'
do
describe
'.to_boolean'
do
it
'accepts booleans'
do
it
'accepts booleans'
do
...
...
spec/models/user_spec.rb
View file @
75f5fa99
...
@@ -693,9 +693,7 @@ describe User, models: true do
...
@@ -693,9 +693,7 @@ describe User, models: true do
end
end
describe
'.search_with_secondary_emails'
do
describe
'.search_with_secondary_emails'
do
def
search_with_secondary_emails
(
query
)
delegate
:search_with_secondary_emails
,
to: :described_class
described_class
.
search_with_secondary_emails
(
query
)
end
let!
(
:user
)
{
create
(
:user
)
}
let!
(
:user
)
{
create
(
:user
)
}
let!
(
:email
)
{
create
(
:email
)
}
let!
(
:email
)
{
create
(
:email
)
}
...
...
spec/services/ci/process_pipeline_service_spec.rb
View file @
75f5fa99
...
@@ -377,9 +377,7 @@ describe Ci::ProcessPipelineService, :services do
...
@@ -377,9 +377,7 @@ describe Ci::ProcessPipelineService, :services do
builds
.
pending
.
update_all
(
status:
'success'
)
builds
.
pending
.
update_all
(
status:
'success'
)
end
end
def
manual_actions
delegate
:manual_actions
,
to: :pipeline
pipeline
.
manual_actions
end
def
create_build
(
name
,
stage_idx
,
when_value
=
nil
)
def
create_build
(
name
,
stage_idx
,
when_value
=
nil
)
create
(
:ci_build
,
create
(
:ci_build
,
...
...
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