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
Tatuya Kamada
gitlab-ce
Commits
f40716f4
Commit
f40716f4
authored
Feb 21, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
No more and/or
parent
deb62183
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
31 additions
and
35 deletions
+31
-35
.rubocop.yml
.rubocop.yml
+5
-0
.rubocop_todo.yml
.rubocop_todo.yml
+0
-7
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+4
-4
app/controllers/import/fogbugz_controller.rb
app/controllers/import/fogbugz_controller.rb
+1
-1
app/controllers/import/google_code_controller.rb
app/controllers/import/google_code_controller.rb
+2
-2
app/controllers/invites_controller.rb
app/controllers/invites_controller.rb
+1
-3
app/controllers/omniauth_callbacks_controller.rb
app/controllers/omniauth_callbacks_controller.rb
+1
-1
app/controllers/profiles/keys_controller.rb
app/controllers/profiles/keys_controller.rb
+2
-2
app/controllers/projects/blob_controller.rb
app/controllers/projects/blob_controller.rb
+1
-1
app/controllers/projects/tree_controller.rb
app/controllers/projects/tree_controller.rb
+2
-2
app/controllers/snippets_controller.rb
app/controllers/snippets_controller.rb
+1
-1
app/models/project.rb
app/models/project.rb
+1
-1
app/models/project_services/drone_ci_service.rb
app/models/project_services/drone_ci_service.rb
+1
-1
app/models/project_services/irker_service.rb
app/models/project_services/irker_service.rb
+1
-1
app/services/projects/upload_service.rb
app/services/projects/upload_service.rb
+1
-1
config/initializers/mysql_ignore_postgresql_options.rb
config/initializers/mysql_ignore_postgresql_options.rb
+1
-1
config/initializers/rack_lineprof.rb
config/initializers/rack_lineprof.rb
+1
-1
config/routes/sidekiq.rb
config/routes/sidekiq.rb
+1
-1
lib/api/helpers.rb
lib/api/helpers.rb
+1
-1
lib/banzai/filter/plantuml_filter.rb
lib/banzai/filter/plantuml_filter.rb
+1
-1
lib/ci/ansi2html.rb
lib/ci/ansi2html.rb
+1
-1
lib/gitlab/metrics/system.rb
lib/gitlab/metrics/system.rb
+1
-1
No files found.
.rubocop.yml
View file @
f40716f4
...
@@ -54,6 +54,11 @@ Style/AlignArray:
...
@@ -54,6 +54,11 @@ Style/AlignArray:
Style/AlignHash
:
Style/AlignHash
:
Enabled
:
true
Enabled
:
true
# Whether `and` and `or` are banned only in conditionals (conditionals)
# or completely (always).
Style/AndOr
:
Enabled
:
true
# Use `Array#join` instead of `Array#*`.
# Use `Array#join` instead of `Array#*`.
Style/ArrayJoin
:
Style/ArrayJoin
:
Enabled
:
true
Enabled
:
true
...
...
.rubocop_todo.yml
View file @
f40716f4
...
@@ -180,13 +180,6 @@ Security/JSONLoad:
...
@@ -180,13 +180,6 @@ Security/JSONLoad:
Style/AlignParameters
:
Style/AlignParameters
:
Enabled
:
false
Enabled
:
false
# Offense count: 27
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: always, conditionals
Style/AndOr
:
Enabled
:
false
# Offense count: 54
# Offense count: 54
# Cop supports --auto-correct.
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# Configuration parameters: EnforcedStyle, SupportedStyles.
...
...
app/controllers/application_controller.rb
View file @
f40716f4
...
@@ -74,7 +74,7 @@ class ApplicationController < ActionController::Base
...
@@ -74,7 +74,7 @@ class ApplicationController < ActionController::Base
def
authenticate_user!
(
*
args
)
def
authenticate_user!
(
*
args
)
if
redirect_to_home_page_url?
if
redirect_to_home_page_url?
re
direct_to
current_application_settings
.
home_page_url
and
return
re
turn
redirect_to
current_application_settings
.
home_page_url
end
end
super
(
*
args
)
super
(
*
args
)
...
@@ -131,7 +131,7 @@ class ApplicationController < ActionController::Base
...
@@ -131,7 +131,7 @@ class ApplicationController < ActionController::Base
headers
[
'X-UA-Compatible'
]
=
'IE=edge'
headers
[
'X-UA-Compatible'
]
=
'IE=edge'
headers
[
'X-Content-Type-Options'
]
=
'nosniff'
headers
[
'X-Content-Type-Options'
]
=
'nosniff'
# Enabling HSTS for non-standard ports would send clients to the wrong port
# Enabling HSTS for non-standard ports would send clients to the wrong port
if
Gitlab
.
config
.
gitlab
.
https
and
Gitlab
.
config
.
gitlab
.
port
==
443
if
Gitlab
.
config
.
gitlab
.
https
&&
Gitlab
.
config
.
gitlab
.
port
==
443
headers
[
'Strict-Transport-Security'
]
=
'max-age=31536000'
headers
[
'Strict-Transport-Security'
]
=
'max-age=31536000'
end
end
end
end
...
@@ -152,7 +152,7 @@ class ApplicationController < ActionController::Base
...
@@ -152,7 +152,7 @@ class ApplicationController < ActionController::Base
def
check_password_expiration
def
check_password_expiration
if
current_user
&&
current_user
.
password_expires_at
&&
current_user
.
password_expires_at
<
Time
.
now
&&
!
current_user
.
ldap_user?
if
current_user
&&
current_user
.
password_expires_at
&&
current_user
.
password_expires_at
<
Time
.
now
&&
!
current_user
.
ldap_user?
re
direct_to
new_profile_password_path
and
return
re
turn
redirect_to
new_profile_password_path
end
end
end
end
...
@@ -218,7 +218,7 @@ class ApplicationController < ActionController::Base
...
@@ -218,7 +218,7 @@ class ApplicationController < ActionController::Base
def
require_email
def
require_email
if
current_user
&&
current_user
.
temp_oauth_email?
&&
session
[
:impersonator_id
].
nil?
if
current_user
&&
current_user
.
temp_oauth_email?
&&
session
[
:impersonator_id
].
nil?
re
direct_to
profile_path
,
notice:
'Please complete your profile with email address'
and
return
re
turn
redirect_to
profile_path
,
notice:
'Please complete your profile with email address'
end
end
end
end
...
...
app/controllers/import/fogbugz_controller.rb
View file @
f40716f4
...
@@ -29,7 +29,7 @@ class Import::FogbugzController < Import::BaseController
...
@@ -29,7 +29,7 @@ class Import::FogbugzController < Import::BaseController
unless
user_map
.
is_a?
(
Hash
)
&&
user_map
.
all?
{
|
k
,
v
|
!
v
[
:name
].
blank?
}
unless
user_map
.
is_a?
(
Hash
)
&&
user_map
.
all?
{
|
k
,
v
|
!
v
[
:name
].
blank?
}
flash
.
now
[
:alert
]
=
'All users must have a name.'
flash
.
now
[
:alert
]
=
'All users must have a name.'
re
nder
'new_user_map'
and
return
re
turn
render
'new_user_map'
end
end
session
[
:fogbugz_user_map
]
=
user_map
session
[
:fogbugz_user_map
]
=
user_map
...
...
app/controllers/import/google_code_controller.rb
View file @
f40716f4
...
@@ -44,13 +44,13 @@ class Import::GoogleCodeController < Import::BaseController
...
@@ -44,13 +44,13 @@ class Import::GoogleCodeController < Import::BaseController
rescue
rescue
flash
.
now
[
:alert
]
=
"The entered user map is not a valid JSON user map."
flash
.
now
[
:alert
]
=
"The entered user map is not a valid JSON user map."
re
nder
"new_user_map"
and
return
re
turn
render
"new_user_map"
end
end
unless
user_map
.
is_a?
(
Hash
)
&&
user_map
.
all?
{
|
k
,
v
|
k
.
is_a?
(
String
)
&&
v
.
is_a?
(
String
)
}
unless
user_map
.
is_a?
(
Hash
)
&&
user_map
.
all?
{
|
k
,
v
|
k
.
is_a?
(
String
)
&&
v
.
is_a?
(
String
)
}
flash
.
now
[
:alert
]
=
"The entered user map is not a valid JSON user map."
flash
.
now
[
:alert
]
=
"The entered user map is not a valid JSON user map."
re
nder
"new_user_map"
and
return
re
turn
render
"new_user_map"
end
end
# This is the default, so let's not save it into the database.
# This is the default, so let's not save it into the database.
...
...
app/controllers/invites_controller.rb
View file @
f40716f4
...
@@ -42,9 +42,7 @@ class InvitesController < ApplicationController
...
@@ -42,9 +42,7 @@ class InvitesController < ApplicationController
@token
=
params
[
:id
]
@token
=
params
[
:id
]
@member
=
Member
.
find_by_invite_token
(
@token
)
@member
=
Member
.
find_by_invite_token
(
@token
)
unless
@member
return
render_404
unless
@member
render_404
and
return
end
@member
@member
end
end
...
...
app/controllers/omniauth_callbacks_controller.rb
View file @
f40716f4
...
@@ -122,7 +122,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
...
@@ -122,7 +122,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
else
else
error_message
=
@user
.
errors
.
full_messages
.
to_sentence
error_message
=
@user
.
errors
.
full_messages
.
to_sentence
re
direct_to
omniauth_error_path
(
oauth
[
'provider'
],
error:
error_message
)
and
return
re
turn
redirect_to
omniauth_error_path
(
oauth
[
'provider'
],
error:
error_message
)
end
end
end
end
...
...
app/controllers/profiles/keys_controller.rb
View file @
f40716f4
...
@@ -45,13 +45,13 @@ class Profiles::KeysController < Profiles::ApplicationController
...
@@ -45,13 +45,13 @@ class Profiles::KeysController < Profiles::ApplicationController
if
user
.
present?
if
user
.
present?
render
text:
user
.
all_ssh_keys
.
join
(
"
\n
"
),
content_type:
"text/plain"
render
text:
user
.
all_ssh_keys
.
join
(
"
\n
"
),
content_type:
"text/plain"
else
else
re
nder_404
and
return
re
turn
render_404
end
end
rescue
=>
e
rescue
=>
e
render
text:
e
.
message
render
text:
e
.
message
end
end
else
else
re
nder_404
and
return
re
turn
render_404
end
end
end
end
...
...
app/controllers/projects/blob_controller.rb
View file @
f40716f4
...
@@ -95,7 +95,7 @@ class Projects::BlobController < Projects::ApplicationController
...
@@ -95,7 +95,7 @@ class Projects::BlobController < Projects::ApplicationController
else
else
if
tree
=
@repository
.
tree
(
@commit
.
id
,
@path
)
if
tree
=
@repository
.
tree
(
@commit
.
id
,
@path
)
if
tree
.
entries
.
any?
if
tree
.
entries
.
any?
re
direct_to
namespace_project_tree_path
(
@project
.
namespace
,
@project
,
File
.
join
(
@ref
,
@path
))
and
return
re
turn
redirect_to
namespace_project_tree_path
(
@project
.
namespace
,
@project
,
File
.
join
(
@ref
,
@path
))
end
end
end
end
...
...
app/controllers/projects/tree_controller.rb
View file @
f40716f4
...
@@ -15,10 +15,10 @@ class Projects::TreeController < Projects::ApplicationController
...
@@ -15,10 +15,10 @@ class Projects::TreeController < Projects::ApplicationController
if
tree
.
entries
.
empty?
if
tree
.
entries
.
empty?
if
@repository
.
blob_at
(
@commit
.
id
,
@path
)
if
@repository
.
blob_at
(
@commit
.
id
,
@path
)
redirect_to
(
re
turn
re
direct_to
(
namespace_project_blob_path
(
@project
.
namespace
,
@project
,
namespace_project_blob_path
(
@project
.
namespace
,
@project
,
File
.
join
(
@ref
,
@path
))
File
.
join
(
@ref
,
@path
))
)
and
return
)
elsif
@path
.
present?
elsif
@path
.
present?
return
render_404
return
render_404
end
end
...
...
app/controllers/snippets_controller.rb
View file @
f40716f4
...
@@ -23,7 +23,7 @@ class SnippetsController < ApplicationController
...
@@ -23,7 +23,7 @@ class SnippetsController < ApplicationController
if
params
[
:username
].
present?
if
params
[
:username
].
present?
@user
=
User
.
find_by
(
username:
params
[
:username
])
@user
=
User
.
find_by
(
username:
params
[
:username
])
re
nder_404
and
return
unless
@user
re
turn
render_404
unless
@user
@snippets
=
SnippetsFinder
.
new
.
execute
(
current_user
,
{
@snippets
=
SnippetsFinder
.
new
.
execute
(
current_user
,
{
filter: :by_user
,
filter: :by_user
,
...
...
app/models/project.rb
View file @
f40716f4
...
@@ -552,7 +552,7 @@ class Project < ActiveRecord::Base
...
@@ -552,7 +552,7 @@ class Project < ActiveRecord::Base
end
end
def
check_limit
def
check_limit
unless
creator
.
can_create_project?
or
namespace
.
kind
==
'group'
unless
creator
.
can_create_project?
||
namespace
.
kind
==
'group'
projects_limit
=
creator
.
projects_limit
projects_limit
=
creator
.
projects_limit
if
projects_limit
==
0
if
projects_limit
==
0
...
...
app/models/project_services/drone_ci_service.rb
View file @
f40716f4
...
@@ -52,7 +52,7 @@ class DroneCiService < CiService
...
@@ -52,7 +52,7 @@ class DroneCiService < CiService
response
=
HTTParty
.
get
(
commit_status_path
(
sha
,
ref
),
verify:
enable_ssl_verification
)
response
=
HTTParty
.
get
(
commit_status_path
(
sha
,
ref
),
verify:
enable_ssl_verification
)
status
=
status
=
if
response
.
code
==
200
and
response
[
'status'
]
if
response
.
code
==
200
&&
response
[
'status'
]
case
response
[
'status'
]
case
response
[
'status'
]
when
'killed'
when
'killed'
:canceled
:canceled
...
...
app/models/project_services/irker_service.rb
View file @
f40716f4
...
@@ -96,7 +96,7 @@ class IrkerService < Service
...
@@ -96,7 +96,7 @@ class IrkerService < Service
rescue
URI
::
InvalidURIError
rescue
URI
::
InvalidURIError
end
end
unless
uri
.
present?
and
default_irc_uri
.
nil?
unless
uri
.
present?
&&
default_irc_uri
.
nil?
begin
begin
new_recipient
=
URI
.
join
(
default_irc_uri
,
'/'
,
recipient
).
to_s
new_recipient
=
URI
.
join
(
default_irc_uri
,
'/'
,
recipient
).
to_s
uri
=
consider_uri
(
URI
.
parse
(
new_recipient
))
uri
=
consider_uri
(
URI
.
parse
(
new_recipient
))
...
...
app/services/projects/upload_service.rb
View file @
f40716f4
...
@@ -5,7 +5,7 @@ module Projects
...
@@ -5,7 +5,7 @@ module Projects
end
end
def
execute
def
execute
return
nil
unless
@file
and
@file
.
size
<=
max_attachment_size
return
nil
unless
@file
&&
@file
.
size
<=
max_attachment_size
uploader
=
FileUploader
.
new
(
@project
)
uploader
=
FileUploader
.
new
(
@project
)
uploader
.
store!
(
@file
)
uploader
.
store!
(
@file
)
...
...
config/initializers/mysql_ignore_postgresql_options.rb
View file @
f40716f4
...
@@ -31,7 +31,7 @@ if defined?(ActiveRecord::ConnectionAdapters::Mysql2Adapter)
...
@@ -31,7 +31,7 @@ if defined?(ActiveRecord::ConnectionAdapters::Mysql2Adapter)
end
end
def
add_index_options
(
table_name
,
column_name
,
options
=
{})
def
add_index_options
(
table_name
,
column_name
,
options
=
{})
if
options
[
:using
]
and
options
[
:using
]
==
:gin
if
options
[
:using
]
&&
options
[
:using
]
==
:gin
options
=
options
.
dup
options
=
options
.
dup
options
.
delete
(
:using
)
options
.
delete
(
:using
)
end
end
...
...
config/initializers/rack_lineprof.rb
View file @
f40716f4
# The default colors of rack-lineprof can be very hard to look at in terminals
# The default colors of rack-lineprof can be very hard to look at in terminals
# with darker backgrounds. This patch tweaks the colors a bit so the output is
# with darker backgrounds. This patch tweaks the colors a bit so the output is
# actually readable.
# actually readable.
if
Rails
.
env
.
development?
and
RUBY_ENGINE
==
'ruby'
and
ENV
[
'ENABLE_LINEPROF'
]
if
Rails
.
env
.
development?
&&
RUBY_ENGINE
==
'ruby'
&&
ENV
[
'ENABLE_LINEPROF'
]
Rails
.
application
.
config
.
middleware
.
use
(
Rack
::
Lineprof
)
Rails
.
application
.
config
.
middleware
.
use
(
Rack
::
Lineprof
)
module
Rack
module
Rack
...
...
config/routes/sidekiq.rb
View file @
f40716f4
constraint
=
lambda
{
|
request
|
request
.
env
[
'warden'
].
authenticate?
and
request
.
env
[
'warden'
].
user
.
admin?
}
constraint
=
lambda
{
|
request
|
request
.
env
[
'warden'
].
authenticate?
&&
request
.
env
[
'warden'
].
user
.
admin?
}
constraints
constraint
do
constraints
constraint
do
mount
Sidekiq
::
Web
,
at:
'/admin/sidekiq'
,
as: :sidekiq
mount
Sidekiq
::
Web
,
at:
'/admin/sidekiq'
,
as: :sidekiq
end
end
lib/api/helpers.rb
View file @
f40716f4
...
@@ -153,7 +153,7 @@ module API
...
@@ -153,7 +153,7 @@ module API
params_hash
=
custom_params
||
params
params_hash
=
custom_params
||
params
attrs
=
{}
attrs
=
{}
keys
.
each
do
|
key
|
keys
.
each
do
|
key
|
if
params_hash
[
key
].
present?
or
(
params_hash
.
has_key?
(
key
)
and
params_hash
[
key
]
==
false
)
if
params_hash
[
key
].
present?
||
(
params_hash
.
has_key?
(
key
)
&&
params_hash
[
key
]
==
false
)
attrs
[
key
]
=
params_hash
[
key
]
attrs
[
key
]
=
params_hash
[
key
]
end
end
end
end
...
...
lib/banzai/filter/plantuml_filter.rb
View file @
f40716f4
...
@@ -7,7 +7,7 @@ module Banzai
...
@@ -7,7 +7,7 @@ module Banzai
#
#
class
PlantumlFilter
<
HTML
::
Pipeline
::
Filter
class
PlantumlFilter
<
HTML
::
Pipeline
::
Filter
def
call
def
call
return
doc
unless
doc
.
at
(
'pre.plantuml'
)
and
settings
.
plantuml_enabled
return
doc
unless
doc
.
at
(
'pre.plantuml'
)
&&
settings
.
plantuml_enabled
plantuml_setup
plantuml_setup
...
...
lib/ci/ansi2html.rb
View file @
f40716f4
...
@@ -126,7 +126,7 @@ module Ci
...
@@ -126,7 +126,7 @@ module Ci
# We are only interested in color and text style changes - triggered by
# We are only interested in color and text style changes - triggered by
# sequences starting with '\e[' and ending with 'm'. Any other control
# sequences starting with '\e[' and ending with 'm'. Any other control
# sequence gets stripped (including stuff like "delete last line")
# sequence gets stripped (including stuff like "delete last line")
return
unless
indicator
==
'['
and
terminator
==
'm'
return
unless
indicator
==
'['
&&
terminator
==
'm'
close_open_tags
()
close_open_tags
()
...
...
lib/gitlab/metrics/system.rb
View file @
f40716f4
...
@@ -11,7 +11,7 @@ module Gitlab
...
@@ -11,7 +11,7 @@ module Gitlab
mem
=
0
mem
=
0
match
=
File
.
read
(
'/proc/self/status'
).
match
(
/VmRSS:\s+(\d+)/
)
match
=
File
.
read
(
'/proc/self/status'
).
match
(
/VmRSS:\s+(\d+)/
)
if
match
and
match
[
1
]
if
match
&&
match
[
1
]
mem
=
match
[
1
].
to_f
*
1024
mem
=
match
[
1
].
to_f
*
1024
end
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