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
Jérome Perrin
gitlab-ce
Commits
128b1eae
Commit
128b1eae
authored
Feb 07, 2017
by
Z.J. van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Rubocop to ruby 2.3
parent
68db614d
Changes
20
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
35 additions
and
47 deletions
+35
-47
.rubocop.yml
.rubocop.yml
+1
-1
app/controllers/projects/wikis_controller.rb
app/controllers/projects/wikis_controller.rb
+1
-1
app/mailers/notify.rb
app/mailers/notify.rb
+1
-1
app/models/application_setting.rb
app/models/application_setting.rb
+11
-17
app/models/concerns/issuable.rb
app/models/concerns/issuable.rb
+2
-2
app/models/concerns/milestoneish.rb
app/models/concerns/milestoneish.rb
+1
-1
app/models/group_milestone.rb
app/models/group_milestone.rb
+1
-1
app/models/project.rb
app/models/project.rb
+1
-1
app/models/user.rb
app/models/user.rb
+1
-1
app/models/wiki_page.rb
app/models/wiki_page.rb
+2
-6
app/services/create_tag_service.rb
app/services/create_tag_service.rb
+1
-1
app/services/delete_tag_service.rb
app/services/delete_tag_service.rb
+1
-1
app/services/projects/create_service.rb
app/services/projects/create_service.rb
+1
-1
app/workers/authorized_projects_worker.rb
app/workers/authorized_projects_worker.rb
+1
-1
lib/api/branches.rb
lib/api/branches.rb
+1
-1
lib/api/entities.rb
lib/api/entities.rb
+1
-3
lib/gitlab/ci/config/entry/configurable.rb
lib/gitlab/ci/config/entry/configurable.rb
+1
-1
lib/gitlab/email/message/repository_push.rb
lib/gitlab/email/message/repository_push.rb
+2
-2
lib/gitlab/git/blob_snippet.rb
lib/gitlab/git/blob_snippet.rb
+1
-1
lib/gitlab/metrics.rb
lib/gitlab/metrics.rb
+3
-3
No files found.
.rubocop.yml
View file @
128b1eae
...
@@ -5,7 +5,7 @@ require:
...
@@ -5,7 +5,7 @@ require:
inherit_from
:
.rubocop_todo.yml
inherit_from
:
.rubocop_todo.yml
AllCops
:
AllCops
:
TargetRubyVersion
:
2.
1
TargetRubyVersion
:
2.
3
# Cop names are not d§splayed in offense messages by default. Change behavior
# Cop names are not d§splayed in offense messages by default. Change behavior
# by overriding DisplayCopNames, or by giving the -D/--display-cop-names
# by overriding DisplayCopNames, or by giving the -D/--display-cop-names
# option.
# option.
...
...
app/controllers/projects/wikis_controller.rb
View file @
128b1eae
...
@@ -83,7 +83,7 @@ class Projects::WikisController < Projects::ApplicationController
...
@@ -83,7 +83,7 @@ class Projects::WikisController < Projects::ApplicationController
def
destroy
def
destroy
@page
=
@project_wiki
.
find_page
(
params
[
:id
])
@page
=
@project_wiki
.
find_page
(
params
[
:id
])
@page
.
delete
if
@pag
e
@page
&
.
delet
e
redirect_to
(
redirect_to
(
namespace_project_wiki_path
(
@project
.
namespace
,
@project
,
:home
),
namespace_project_wiki_path
(
@project
.
namespace
,
@project
,
:home
),
...
...
app/mailers/notify.rb
View file @
128b1eae
...
@@ -151,7 +151,7 @@ class Notify < BaseMailer
...
@@ -151,7 +151,7 @@ class Notify < BaseMailer
headers
[
'In-Reply-To'
]
=
message_id
(
model
)
headers
[
'In-Reply-To'
]
=
message_id
(
model
)
headers
[
'References'
]
=
message_id
(
model
)
headers
[
'References'
]
=
message_id
(
model
)
headers
[
:subject
]
.
prepend
(
'Re: '
)
if
headers
[
:subject
]
headers
[
:subject
]
&
.
prepend
(
'Re: '
)
mail_thread
(
model
,
headers
)
mail_thread
(
model
,
headers
)
end
end
...
...
app/models/application_setting.rb
View file @
128b1eae
...
@@ -116,34 +116,28 @@ class ApplicationSetting < ActiveRecord::Base
...
@@ -116,34 +116,28 @@ class ApplicationSetting < ActiveRecord::Base
numericality:
{
only_integer:
true
,
greater_than_or_equal_to:
0
}
numericality:
{
only_integer:
true
,
greater_than_or_equal_to:
0
}
validates_each
:restricted_visibility_levels
do
|
record
,
attr
,
value
|
validates_each
:restricted_visibility_levels
do
|
record
,
attr
,
value
|
unless
value
.
nil?
value
&
.
each
do
|
level
|
value
.
each
do
|
level
|
unless
Gitlab
::
VisibilityLevel
.
options
.
has_value?
(
level
)
unless
Gitlab
::
VisibilityLevel
.
options
.
has_value?
(
level
)
record
.
errors
.
add
(
attr
,
"'
#{
level
}
' is not a valid visibility level"
)
record
.
errors
.
add
(
attr
,
"'
#{
level
}
' is not a valid visibility level"
)
end
end
end
end
end
end
end
validates_each
:import_sources
do
|
record
,
attr
,
value
|
validates_each
:import_sources
do
|
record
,
attr
,
value
|
unless
value
.
nil?
value
&
.
each
do
|
source
|
value
.
each
do
|
source
|
unless
Gitlab
::
ImportSources
.
options
.
has_value?
(
source
)
unless
Gitlab
::
ImportSources
.
options
.
has_value?
(
source
)
record
.
errors
.
add
(
attr
,
"'
#{
source
}
' is not a import source"
)
record
.
errors
.
add
(
attr
,
"'
#{
source
}
' is not a import source"
)
end
end
end
end
end
end
end
validates_each
:disabled_oauth_sign_in_sources
do
|
record
,
attr
,
value
|
validates_each
:disabled_oauth_sign_in_sources
do
|
record
,
attr
,
value
|
unless
value
.
nil?
value
&
.
each
do
|
source
|
value
.
each
do
|
source
|
unless
Devise
.
omniauth_providers
.
include?
(
source
.
to_sym
)
unless
Devise
.
omniauth_providers
.
include?
(
source
.
to_sym
)
record
.
errors
.
add
(
attr
,
"'
#{
source
}
' is not an OAuth sign-in source"
)
record
.
errors
.
add
(
attr
,
"'
#{
source
}
' is not an OAuth sign-in source"
)
end
end
end
end
end
end
end
before_save
:ensure_runners_registration_token
before_save
:ensure_runners_registration_token
before_save
:ensure_health_check_access_token
before_save
:ensure_health_check_access_token
...
@@ -230,11 +224,11 @@ class ApplicationSetting < ActiveRecord::Base
...
@@ -230,11 +224,11 @@ class ApplicationSetting < ActiveRecord::Base
end
end
def
domain_whitelist_raw
def
domain_whitelist_raw
self
.
domain_whitelist
.
join
(
"
\n
"
)
unless
self
.
domain_whitelist
.
nil?
self
.
domain_whitelist
&
.
join
(
"
\n
"
)
end
end
def
domain_blacklist_raw
def
domain_blacklist_raw
self
.
domain_blacklist
.
join
(
"
\n
"
)
unless
self
.
domain_blacklist
.
nil?
self
.
domain_blacklist
&
.
join
(
"
\n
"
)
end
end
def
domain_whitelist_raw
=
(
values
)
def
domain_whitelist_raw
=
(
values
)
...
...
app/models/concerns/issuable.rb
View file @
128b1eae
...
@@ -95,8 +95,8 @@ module Issuable
...
@@ -95,8 +95,8 @@ module Issuable
def
update_assignee_cache_counts
def
update_assignee_cache_counts
# make sure we flush the cache for both the old *and* new assignees(if they exist)
# make sure we flush the cache for both the old *and* new assignees(if they exist)
previous_assignee
=
User
.
find_by_id
(
assignee_id_was
)
if
assignee_id_was
previous_assignee
=
User
.
find_by_id
(
assignee_id_was
)
if
assignee_id_was
previous_assignee
.
update_cache_counts
if
previous_assignee
previous_assignee
&
.
update_cache_counts
assignee
.
update_cache_counts
if
assignee
assignee
&
.
update_cache_counts
end
end
# We want to use optimistic lock for cases when only title or description are involved
# We want to use optimistic lock for cases when only title or description are involved
...
...
app/models/concerns/milestoneish.rb
View file @
128b1eae
...
@@ -73,7 +73,7 @@ module Milestoneish
...
@@ -73,7 +73,7 @@ module Milestoneish
def
memoize_per_user
(
user
,
method_name
)
def
memoize_per_user
(
user
,
method_name
)
@memoized
||=
{}
@memoized
||=
{}
@memoized
[
method_name
]
||=
{}
@memoized
[
method_name
]
||=
{}
@memoized
[
method_name
][
user
.
try!
(
:id
)
]
||=
yield
@memoized
[
method_name
][
user
&
.
id
]
||=
yield
end
end
# override in a class that includes this module to get a faster query
# override in a class that includes this module to get a faster query
...
...
app/models/group_milestone.rb
View file @
128b1eae
...
@@ -9,7 +9,7 @@ class GroupMilestone < GlobalMilestone
...
@@ -9,7 +9,7 @@ class GroupMilestone < GlobalMilestone
def
self
.
build
(
group
,
projects
,
title
)
def
self
.
build
(
group
,
projects
,
title
)
super
(
projects
,
title
).
tap
do
|
milestone
|
super
(
projects
,
title
).
tap
do
|
milestone
|
milestone
.
group
=
group
if
milestone
milestone
&
.
group
=
group
end
end
end
end
...
...
app/models/project.rb
View file @
128b1eae
...
@@ -461,7 +461,7 @@ class Project < ActiveRecord::Base
...
@@ -461,7 +461,7 @@ class Project < ActiveRecord::Base
def
reset_cache_and_import_attrs
def
reset_cache_and_import_attrs
ProjectCacheWorker
.
perform_async
(
self
.
id
)
ProjectCacheWorker
.
perform_async
(
self
.
id
)
self
.
import_data
.
destroy
if
self
.
import_data
self
.
import_data
&
.
destroy
end
end
def
import_url
=
(
value
)
def
import_url
=
(
value
)
...
...
app/models/user.rb
View file @
128b1eae
...
@@ -304,7 +304,7 @@ class User < ActiveRecord::Base
...
@@ -304,7 +304,7 @@ class User < ActiveRecord::Base
def
find_by_personal_access_token
(
token_string
)
def
find_by_personal_access_token
(
token_string
)
personal_access_token
=
PersonalAccessToken
.
active
.
find_by_token
(
token_string
)
if
token_string
personal_access_token
=
PersonalAccessToken
.
active
.
find_by_token
(
token_string
)
if
token_string
personal_access_token
.
user
if
personal_access_token
personal_access_token
&
.
user
end
end
# Returns a user for the given SSH key.
# Returns a user for the given SSH key.
...
...
app/models/wiki_page.rb
View file @
128b1eae
...
@@ -69,16 +69,12 @@ class WikiPage
...
@@ -69,16 +69,12 @@ class WikiPage
# The raw content of this page.
# The raw content of this page.
def
content
def
content
@attributes
[
:content
]
||=
if
@page
@attributes
[
:content
]
||=
@page
&
.
text_data
@page
.
text_data
end
end
end
# The processed/formatted content of this page.
# The processed/formatted content of this page.
def
formatted_content
def
formatted_content
@attributes
[
:formatted_content
]
||=
if
@page
@attributes
[
:formatted_content
]
||=
@page
&
.
formatted_data
@page
.
formatted_data
end
end
end
# The markup format for the page.
# The markup format for the page.
...
...
app/services/create_tag_service.rb
View file @
128b1eae
...
@@ -4,7 +4,7 @@ class CreateTagService < BaseService
...
@@ -4,7 +4,7 @@ class CreateTagService < BaseService
return
error
(
'Tag name invalid'
)
unless
valid_tag
return
error
(
'Tag name invalid'
)
unless
valid_tag
repository
=
project
.
repository
repository
=
project
.
repository
message
.
strip!
if
message
message
&
.
strip!
new_tag
=
nil
new_tag
=
nil
...
...
app/services/delete_tag_service.rb
View file @
128b1eae
...
@@ -9,7 +9,7 @@ class DeleteTagService < BaseService
...
@@ -9,7 +9,7 @@ class DeleteTagService < BaseService
if
repository
.
rm_tag
(
current_user
,
tag_name
)
if
repository
.
rm_tag
(
current_user
,
tag_name
)
release
=
project
.
releases
.
find_by
(
tag:
tag_name
)
release
=
project
.
releases
.
find_by
(
tag:
tag_name
)
release
.
destroy
if
release
release
&
.
destroy
push_data
=
build_push_data
(
tag
)
push_data
=
build_push_data
(
tag
)
EventCreateService
.
new
.
push
(
project
,
current_user
,
push_data
)
EventCreateService
.
new
.
push
(
project
,
current_user
,
push_data
)
...
...
app/services/projects/create_service.rb
View file @
128b1eae
...
@@ -97,7 +97,7 @@ module Projects
...
@@ -97,7 +97,7 @@ module Projects
@project
.
team
<<
[
current_user
,
:master
,
current_user
]
@project
.
team
<<
[
current_user
,
:master
,
current_user
]
end
end
@project
.
group
.
refresh_members_authorized_projects
if
@project
.
group
@project
.
group
&
.
refresh_members_authorized_projects
end
end
def
skip_wiki?
def
skip_wiki?
...
...
app/workers/authorized_projects_worker.rb
View file @
128b1eae
...
@@ -16,6 +16,6 @@ class AuthorizedProjectsWorker
...
@@ -16,6 +16,6 @@ class AuthorizedProjectsWorker
def
perform
(
user_id
)
def
perform
(
user_id
)
user
=
User
.
find_by
(
id:
user_id
)
user
=
User
.
find_by
(
id:
user_id
)
user
.
refresh_authorized_projects
if
user
user
&
.
refresh_authorized_projects
end
end
end
end
lib/api/branches.rb
View file @
128b1eae
...
@@ -84,7 +84,7 @@ module API
...
@@ -84,7 +84,7 @@ module API
branch
=
user_project
.
repository
.
find_branch
(
params
[
:branch
])
branch
=
user_project
.
repository
.
find_branch
(
params
[
:branch
])
not_found!
(
"Branch"
)
unless
branch
not_found!
(
"Branch"
)
unless
branch
protected_branch
=
user_project
.
protected_branches
.
find_by
(
name:
branch
.
name
)
protected_branch
=
user_project
.
protected_branches
.
find_by
(
name:
branch
.
name
)
protected_branch
.
destroy
if
protected_branch
protected_branch
&
.
destroy
present
branch
,
with:
Entities
::
RepoBranch
,
project:
user_project
present
branch
,
with:
Entities
::
RepoBranch
,
project:
user_project
end
end
...
...
lib/api/entities.rb
View file @
128b1eae
...
@@ -382,9 +382,7 @@ module API
...
@@ -382,9 +382,7 @@ module API
expose
:author
,
using:
Entities
::
UserBasic
,
if:
->
(
event
,
options
)
{
event
.
author
}
expose
:author
,
using:
Entities
::
UserBasic
,
if:
->
(
event
,
options
)
{
event
.
author
}
expose
:author_username
do
|
event
,
options
|
expose
:author_username
do
|
event
,
options
|
if
event
.
author
event
.
author
&
.
username
event
.
author
.
username
end
end
end
end
end
...
...
lib/gitlab/ci/config/entry/configurable.rb
View file @
128b1eae
...
@@ -58,7 +58,7 @@ module Gitlab
...
@@ -58,7 +58,7 @@ module Gitlab
def
helpers
(
*
nodes
)
def
helpers
(
*
nodes
)
nodes
.
each
do
|
symbol
|
nodes
.
each
do
|
symbol
|
define_method
(
"
#{
symbol
}
_defined?"
)
do
define_method
(
"
#{
symbol
}
_defined?"
)
do
@entries
[
symbol
]
.
specified?
if
@entries
[
symbol
]
@entries
[
symbol
]
&
.
specified?
end
end
define_method
(
"
#{
symbol
}
_value"
)
do
define_method
(
"
#{
symbol
}
_value"
)
do
...
...
lib/gitlab/email/message/repository_push.rb
View file @
128b1eae
...
@@ -46,7 +46,7 @@ module Gitlab
...
@@ -46,7 +46,7 @@ module Gitlab
end
end
def
diffs_count
def
diffs_count
diffs
.
size
if
diffs
diffs
&
.
size
end
end
def
compare
def
compare
...
@@ -58,7 +58,7 @@ module Gitlab
...
@@ -58,7 +58,7 @@ module Gitlab
end
end
def
compare_timeout
def
compare_timeout
diffs
.
overflow?
if
diffs
diffs
&
.
overflow?
end
end
def
reverse_compare?
def
reverse_compare?
...
...
lib/gitlab/git/blob_snippet.rb
View file @
128b1eae
...
@@ -13,7 +13,7 @@ module Gitlab
...
@@ -13,7 +13,7 @@ module Gitlab
end
end
def
data
def
data
lines
.
join
(
"
\n
"
)
if
lines
lines
&
.
join
(
"
\n
"
)
end
end
def
name
def
name
...
...
lib/gitlab/metrics.rb
View file @
128b1eae
...
@@ -112,7 +112,7 @@ module Gitlab
...
@@ -112,7 +112,7 @@ module Gitlab
def
self
.
tag_transaction
(
name
,
value
)
def
self
.
tag_transaction
(
name
,
value
)
trans
=
current_transaction
trans
=
current_transaction
trans
.
add_tag
(
name
,
value
)
if
trans
trans
&
.
add_tag
(
name
,
value
)
end
end
# Sets the action of the current transaction (if any)
# Sets the action of the current transaction (if any)
...
@@ -121,7 +121,7 @@ module Gitlab
...
@@ -121,7 +121,7 @@ module Gitlab
def
self
.
action
=
(
action
)
def
self
.
action
=
(
action
)
trans
=
current_transaction
trans
=
current_transaction
trans
.
action
=
action
if
trans
trans
&
.
action
=
action
end
end
# Tracks an event.
# Tracks an event.
...
@@ -130,7 +130,7 @@ module Gitlab
...
@@ -130,7 +130,7 @@ module Gitlab
def
self
.
add_event
(
*
args
)
def
self
.
add_event
(
*
args
)
trans
=
current_transaction
trans
=
current_transaction
trans
.
add_event
(
*
args
)
if
trans
trans
&
.
add_event
(
*
args
)
end
end
# Returns the prefix to use for the name of a series.
# Returns the prefix to use for the name of a series.
...
...
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