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
5c7f9d69
Commit
5c7f9d69
authored
7 years ago
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix code for cops
parent
02494f7c
No related merge requests found
Changes
44
Show whitespace changes
Inline
Side-by-side
Showing
44 changed files
with
245 additions
and
213 deletions
+245
-213
app/controllers/concerns/creates_commit.rb
app/controllers/concerns/creates_commit.rb
+8
-7
app/controllers/projects/git_http_client_controller.rb
app/controllers/projects/git_http_client_controller.rb
+6
-5
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+9
-8
app/controllers/sessions_controller.rb
app/controllers/sessions_controller.rb
+6
-5
app/finders/notes_finder.rb
app/finders/notes_finder.rb
+6
-5
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+6
-5
app/helpers/blob_helper.rb
app/helpers/blob_helper.rb
+11
-10
app/helpers/submodule_helper.rb
app/helpers/submodule_helper.rb
+1
-1
app/mailers/repository_check_mailer.rb
app/mailers/repository_check_mailer.rb
+6
-5
app/models/commit.rb
app/models/commit.rb
+6
-5
app/models/concerns/case_sensitivity.rb
app/models/concerns/case_sensitivity.rb
+6
-5
app/models/concerns/sortable.rb
app/models/concerns/sortable.rb
+6
-5
app/models/network/graph.rb
app/models/network/graph.rb
+6
-5
app/models/project.rb
app/models/project.rb
+8
-7
app/models/project_services/pushover_service.rb
app/models/project_services/pushover_service.rb
+8
-7
app/services/system_note_service.rb
app/services/system_note_service.rb
+7
-6
config/initializers/1_settings.rb
config/initializers/1_settings.rb
+23
-21
lib/api/api_guard.rb
lib/api/api_guard.rb
+1
-1
lib/api/award_emoji.rb
lib/api/award_emoji.rb
+1
-1
lib/banzai/filter/abstract_reference_filter.rb
lib/banzai/filter/abstract_reference_filter.rb
+6
-5
lib/banzai/filter/gollum_tags_filter.rb
lib/banzai/filter/gollum_tags_filter.rb
+6
-5
lib/banzai/filter/issue_reference_filter.rb
lib/banzai/filter/issue_reference_filter.rb
+6
-5
lib/gitlab/award_emoji.rb
lib/gitlab/award_emoji.rb
+6
-5
lib/gitlab/ci/config/entry/global.rb
lib/gitlab/ci/config/entry/global.rb
+1
-1
lib/gitlab/ci/config/entry/jobs.rb
lib/gitlab/ci/config/entry/jobs.rb
+1
-1
lib/gitlab/conflict/file.rb
lib/gitlab/conflict/file.rb
+6
-5
lib/gitlab/diff/position.rb
lib/gitlab/diff/position.rb
+10
-9
lib/gitlab/email/reply_parser.rb
lib/gitlab/email/reply_parser.rb
+6
-5
lib/gitlab/metrics/instrumentation.rb
lib/gitlab/metrics/instrumentation.rb
+6
-5
lib/gitlab/saml/user.rb
lib/gitlab/saml/user.rb
+6
-5
lib/gitlab/search_results.rb
lib/gitlab/search_results.rb
+12
-10
lib/gitlab/shell.rb
lib/gitlab/shell.rb
+1
-1
lib/gitlab/sherlock/query.rb
lib/gitlab/sherlock/query.rb
+6
-5
spec/features/issuables/issuable_list_spec.rb
spec/features/issuables/issuable_list_spec.rb
+6
-5
spec/helpers/issues_helper_spec.rb
spec/helpers/issues_helper_spec.rb
+1
-1
spec/lib/gitlab/ci/config/entry/global_spec.rb
spec/lib/gitlab/ci/config/entry/global_spec.rb
+2
-2
spec/lib/gitlab/ci/config/entry/job_spec.rb
spec/lib/gitlab/ci/config/entry/job_spec.rb
+5
-5
spec/lib/gitlab/ci/status/build/factory_spec.rb
spec/lib/gitlab/ci/status/build/factory_spec.rb
+1
-1
spec/lib/gitlab/incoming_email_spec.rb
spec/lib/gitlab/incoming_email_spec.rb
+2
-2
spec/lib/gitlab/o_auth/user_spec.rb
spec/lib/gitlab/o_auth/user_spec.rb
+2
-2
spec/lib/gitlab/saml/user_spec.rb
spec/lib/gitlab/saml/user_spec.rb
+3
-3
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+1
-1
spec/support/issuables_list_metadata_shared_examples.rb
spec/support/issuables_list_metadata_shared_examples.rb
+6
-5
spec/support/login_helpers.rb
spec/support/login_helpers.rb
+6
-5
No files found.
app/controllers/concerns/creates_commit.rb
View file @
5c7f9d69
...
...
@@ -101,7 +101,8 @@ module CreatesCommit
# TODO: We should really clean this up
def
set_commit_variables
@mr_source_project
=
if
can?
(
current_user
,
:push_code
,
@project
)
@mr_source_project
=
if
can?
(
current_user
,
:push_code
,
@project
)
# Edit file in this project
@project
else
...
...
This diff is collapsed.
Click to expand it.
app/controllers/projects/git_http_client_controller.rb
View file @
5c7f9d69
...
...
@@ -76,7 +76,8 @@ class Projects::GitHttpClientController < Projects::ApplicationController
return
@project
if
defined?
(
@project
)
project_id
,
_
=
project_id_with_suffix
@project
=
if
project_id
.
blank?
@project
=
if
project_id
.
blank?
nil
else
Project
.
find_by_full_path
(
"
#{
params
[
:namespace_id
]
}
/
#{
project_id
}
"
)
...
...
This diff is collapsed.
Click to expand it.
app/controllers/projects/merge_requests_controller.rb
View file @
5c7f9d69
...
...
@@ -381,7 +381,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end
def
merge_widget_refresh
@status
=
if
merge_request
.
merge_when_build_succeeds
@status
=
if
merge_request
.
merge_when_build_succeeds
:merge_when_build_succeeds
else
# Only MRs that can be merged end in this action
...
...
This diff is collapsed.
Click to expand it.
app/controllers/sessions_controller.rb
View file @
5c7f9d69
...
...
@@ -15,7 +15,8 @@ class SessionsController < Devise::SessionsController
def
new
set_minimum_password_length
@ldap_servers
=
if
Gitlab
.
config
.
ldap
.
enabled
@ldap_servers
=
if
Gitlab
.
config
.
ldap
.
enabled
Gitlab
::
LDAP
::
Config
.
servers
else
[]
...
...
This diff is collapsed.
Click to expand it.
app/finders/notes_finder.rb
View file @
5c7f9d69
...
...
@@ -28,7 +28,8 @@ class NotesFinder
private
def
init_collection
@notes
=
if
@params
[
:target_id
]
@notes
=
if
@params
[
:target_id
]
on_target
(
@params
[
:target_type
],
@params
[
:target_id
])
else
notes_of_any_type
...
...
This diff is collapsed.
Click to expand it.
app/helpers/application_helper.rb
View file @
5c7f9d69
...
...
@@ -69,7 +69,8 @@ module ApplicationHelper
end
def
avatar_icon
(
user_or_email
=
nil
,
size
=
nil
,
scale
=
2
)
user
=
if
user_or_email
.
is_a?
(
User
)
user
=
if
user_or_email
.
is_a?
(
User
)
user_or_email
else
User
.
find_by_any_email
(
user_or_email
.
try
(
:downcase
))
...
...
This diff is collapsed.
Click to expand it.
app/helpers/blob_helper.rb
View file @
5c7f9d69
...
...
@@ -153,7 +153,8 @@ module BlobHelper
# Because we are opionated we set the cache headers ourselves.
response
.
cache_control
[
:public
]
=
@project
.
public?
response
.
cache_control
[
:max_age
]
=
if
@ref
&&
@commit
&&
@ref
==
@commit
.
id
response
.
cache_control
[
:max_age
]
=
if
@ref
&&
@commit
&&
@ref
==
@commit
.
id
# This is a link to a commit by its commit SHA. That means that the blob
# is immutable. The only reason to invalidate the cache is if the commit
# was deleted or if the user lost access to the repository.
...
...
This diff is collapsed.
Click to expand it.
app/helpers/submodule_helper.rb
View file @
5c7f9d69
This diff is collapsed.
Click to expand it.
app/mailers/repository_check_mailer.rb
View file @
5c7f9d69
class
RepositoryCheckMailer
<
BaseMailer
def
notify
(
failed_count
)
@message
=
if
failed_count
==
1
@message
=
if
failed_count
==
1
"One project failed its last repository check"
else
"
#{
failed_count
}
projects failed their last repository check"
...
...
This diff is collapsed.
Click to expand it.
app/models/commit.rb
View file @
5c7f9d69
...
...
@@ -122,7 +122,8 @@ class Commit
def
full_title
return
@full_title
if
@full_title
@full_title
=
if
safe_message
.
blank?
@full_title
=
if
safe_message
.
blank?
no_commit_message
else
safe_message
.
split
(
"
\n
"
,
2
).
first
...
...
This diff is collapsed.
Click to expand it.
app/models/concerns/case_sensitivity.rb
View file @
5c7f9d69
...
...
@@ -13,7 +13,8 @@ module CaseSensitivity
params
.
each
do
|
key
,
value
|
column
=
ActiveRecord
::
Base
.
connection
.
quote_table_name
(
key
)
condition
=
if
cast_lower
condition
=
if
cast_lower
"LOWER(
#{
column
}
) = LOWER(:value)"
else
"
#{
column
}
= :value"
...
...
This diff is collapsed.
Click to expand it.
app/models/concerns/sortable.rb
View file @
5c7f9d69
...
...
@@ -46,7 +46,8 @@ module Sortable
where
(
"label_links.target_id =
#{
target_column
}
"
).
reorder
(
nil
)
query
=
if
target_type_column
query
=
if
target_type_column
query
.
where
(
"label_links.target_type =
#{
target_type_column
}
"
)
else
query
.
where
(
label_links:
{
target_type:
target_type
})
...
...
This diff is collapsed.
Click to expand it.
app/models/network/graph.rb
View file @
5c7f9d69
...
...
@@ -188,7 +188,8 @@ module Network
end
# and mark it as reserved
min_time
=
if
parent_time
.
nil?
min_time
=
if
parent_time
.
nil?
leaves
.
first
.
time
else
parent_time
+
1
...
...
This diff is collapsed.
Click to expand it.
app/models/project.rb
View file @
5c7f9d69
...
...
@@ -453,7 +453,8 @@ class Project < ActiveRecord::Base
end
def
add_import_job
job_id
=
if
forked?
job_id
=
if
forked?
RepositoryForkWorker
.
perform_async
(
id
,
forked_from_project
.
repository_storage_path
,
forked_from_project
.
path_with_namespace
,
self
.
namespace
.
full_path
)
...
...
This diff is collapsed.
Click to expand it.
app/models/project_services/pushover_service.rb
View file @
5c7f9d69
...
...
@@ -72,7 +72,8 @@ class PushoverService < Service
before
=
data
[
:before
]
after
=
data
[
:after
]
message
=
if
Gitlab
::
Git
.
blank_ref?
(
before
)
message
=
if
Gitlab
::
Git
.
blank_ref?
(
before
)
"
#{
data
[
:user_name
]
}
pushed new branch
\"
#{
ref
}
\"
."
elsif
Gitlab
::
Git
.
blank_ref?
(
after
)
"
#{
data
[
:user_name
]
}
deleted branch
\"
#{
ref
}
\"
."
...
...
This diff is collapsed.
Click to expand it.
app/services/system_note_service.rb
View file @
5c7f9d69
...
...
@@ -408,7 +408,8 @@ module SystemNoteService
# Initial scope should be system notes of this noteable type
notes
=
Note
.
system
.
where
(
noteable_type:
noteable
.
class
)
notes
=
if
noteable
.
is_a?
(
Commit
)
notes
=
if
noteable
.
is_a?
(
Commit
)
# Commits have non-integer IDs, so they're stored in `commit_id`
notes
.
where
(
commit_id:
noteable
.
id
)
else
...
...
This diff is collapsed.
Click to expand it.
config/initializers/1_settings.rb
View file @
5c7f9d69
...
...
@@ -14,7 +14,8 @@ class Settings < Settingslogic
end
def
build_gitlab_ci_url
custom_port
=
if
on_standard_port?
(
gitlab
)
custom_port
=
if
on_standard_port?
(
gitlab
)
nil
else
":
#{
gitlab
.
port
}
"
...
...
@@ -160,7 +161,8 @@ if github_settings
github_settings
[
"args"
]
||=
Settingslogic
.
new
({})
github_settings
[
"args"
][
"client_options"
]
=
if
github_settings
[
"url"
].
include?
(
github_default_url
)
github_settings
[
"args"
][
"client_options"
]
=
if
github_settings
[
"url"
].
include?
(
github_default_url
)
OmniAuth
::
Strategies
::
GitHub
.
default_options
[
:client_options
]
else
{
...
...
This diff is collapsed.
Click to expand it.
lib/api/api_guard.rb
View file @
5c7f9d69
This diff is collapsed.
Click to expand it.
lib/api/award_emoji.rb
View file @
5c7f9d69
This diff is collapsed.
Click to expand it.
lib/banzai/filter/abstract_reference_filter.rb
View file @
5c7f9d69
...
...
@@ -160,7 +160,8 @@ module Banzai
data
=
data_attributes_for
(
link_content
||
match
,
project
,
object
,
link:
!!
link_content
)
url
=
if
matches
.
names
.
include?
(
"url"
)
&&
matches
[
:url
]
url
=
if
matches
.
names
.
include?
(
"url"
)
&&
matches
[
:url
]
matches
[
:url
]
else
url_for_object_cached
(
object
,
project
)
...
...
This diff is collapsed.
Click to expand it.
lib/banzai/filter/gollum_tags_filter.rb
View file @
5c7f9d69
...
...
@@ -149,7 +149,8 @@ module Banzai
name
,
reference
=
*
parts
.
compact
.
map
(
&
:strip
)
end
href
=
if
url?
(
reference
)
href
=
if
url?
(
reference
)
reference
else
::
File
.
join
(
project_wiki_base_path
,
reference
)
...
...
This diff is collapsed.
Click to expand it.
lib/banzai/filter/issue_reference_filter.rb
View file @
5c7f9d69
...
...
@@ -39,7 +39,8 @@ module Banzai
projects_per_reference
.
each
do
|
path
,
project
|
issue_ids
=
references_per_project
[
path
]
issues
=
if
project
.
default_issues_tracker?
issues
=
if
project
.
default_issues_tracker?
project
.
issues
.
where
(
iid:
issue_ids
.
to_a
)
else
issue_ids
.
map
{
|
id
|
ExternalIssue
.
new
(
id
,
project
)
}
...
...
This diff is collapsed.
Click to expand it.
lib/gitlab/award_emoji.rb
View file @
5c7f9d69
...
...
@@ -69,7 +69,8 @@ module Gitlab
end
JSON
.
parse
(
File
.
read
(
path
)).
map
do
|
hash
|
fname
=
if
digest
fname
=
if
digest
"
#{
hash
[
'unicode'
]
}
-
#{
hash
[
'digest'
]
}
"
else
hash
[
'unicode'
]
...
...
This diff is collapsed.
Click to expand it.
lib/gitlab/ci/config/entry/global.rb
View file @
5c7f9d69
This diff is collapsed.
Click to expand it.
lib/gitlab/ci/config/entry/jobs.rb
View file @
5c7f9d69
This diff is collapsed.
Click to expand it.
lib/gitlab/conflict/file.rb
View file @
5c7f9d69
...
...
@@ -91,7 +91,8 @@ module Gitlab
our_highlight
=
Gitlab
::
Highlight
.
highlight
(
our_path
,
our_file
,
repository:
repository
).
lines
lines
.
each
do
|
line
|
line
.
rich_text
=
if
line
.
type
==
'old'
line
.
rich_text
=
if
line
.
type
==
'old'
their_highlight
[
line
.
old_line
-
1
].
try
(
:html_safe
)
else
our_highlight
[
line
.
new_line
-
1
].
try
(
:html_safe
)
...
...
This diff is collapsed.
Click to expand it.
lib/gitlab/diff/position.rb
View file @
5c7f9d69
...
...
@@ -140,7 +140,8 @@ module Gitlab
def
find_diff_file
(
repository
)
# We're at the initial commit, so just get that as we can't compare to anything.
compare
=
if
Gitlab
::
Git
.
blank_ref?
(
start_sha
)
compare
=
if
Gitlab
::
Git
.
blank_ref?
(
start_sha
)
Gitlab
::
Git
::
Commit
.
find
(
repository
.
raw_repository
,
head_sha
)
else
Gitlab
::
Git
::
Compare
.
new
(
...
...
This diff is collapsed.
Click to expand it.
lib/gitlab/email/reply_parser.rb
View file @
5c7f9d69
...
...
@@ -31,7 +31,8 @@ module Gitlab
private
def
select_body
(
message
)
part
=
if
message
.
multipart?
part
=
if
message
.
multipart?
message
.
text_part
||
message
.
html_part
||
message
else
message
...
...
This diff is collapsed.
Click to expand it.
lib/gitlab/metrics/instrumentation.rb
View file @
5c7f9d69
...
...
@@ -143,7 +143,8 @@ module Gitlab
# signature this would break things. As a result we'll make sure the
# generated method _only_ accepts regular arguments if the underlying
# method also accepts them.
args_signature
=
if
method
.
arity
==
0
args_signature
=
if
method
.
arity
==
0
''
else
'*args'
...
...
This diff is collapsed.
Click to expand it.
lib/gitlab/saml/user.rb
View file @
5c7f9d69
...
...
@@ -28,7 +28,8 @@ module Gitlab
if
external_users_enabled?
&&
@user
# Check if there is overlap between the user's groups and the external groups
# setting then set user as external or internal.
@user
.
external
=
if
(
auth_hash
.
groups
&
Gitlab
::
Saml
::
Config
.
external_groups
).
empty?
@user
.
external
=
if
(
auth_hash
.
groups
&
Gitlab
::
Saml
::
Config
.
external_groups
).
empty?
false
else
true
...
...
This diff is collapsed.
Click to expand it.
lib/gitlab/search_results.rb
View file @
5c7f9d69
...
...
@@ -56,7 +56,8 @@ module Gitlab
def
issues
issues
=
IssuesFinder
.
new
(
current_user
).
execute
.
where
(
project_id:
project_ids_relation
)
issues
=
if
query
=~
/#(\d+)\z/
issues
=
if
query
=~
/#(\d+)\z/
issues
.
where
(
iid:
$1
)
else
issues
.
full_search
(
query
)
...
...
@@ -73,7 +74,8 @@ module Gitlab
def
merge_requests
merge_requests
=
MergeRequestsFinder
.
new
(
current_user
).
execute
.
in_projects
(
project_ids_relation
)
merge_requests
=
if
query
=~
/[#!](\d+)\z/
merge_requests
=
if
query
=~
/[#!](\d+)\z/
merge_requests
.
where
(
iid:
$1
)
else
merge_requests
.
full_search
(
query
)
...
...
This diff is collapsed.
Click to expand it.
lib/gitlab/shell.rb
View file @
5c7f9d69
This diff is collapsed.
Click to expand it.
lib/gitlab/sherlock/query.rb
View file @
5c7f9d69
...
...
@@ -94,7 +94,8 @@ module Gitlab
private
def
raw_explain
(
query
)
explain
=
if
Gitlab
::
Database
.
postgresql?
explain
=
if
Gitlab
::
Database
.
postgresql?
"EXPLAIN ANALYZE
#{
query
}
;"
else
"EXPLAIN
#{
query
}
;"
...
...
This diff is collapsed.
Click to expand it.
spec/features/issuables/issuable_list_spec.rb
View file @
5c7f9d69
...
...
@@ -47,7 +47,8 @@ describe 'issuable list', feature: true do
def
create_issuables
(
issuable_type
)
3
.
times
do
issuable
=
if
issuable_type
==
:issue
issuable
=
if
issuable_type
==
:issue
create
(
:issue
,
project:
project
,
author:
user
)
else
create
(
:merge_request
,
title:
FFaker
::
Lorem
.
sentence
,
source_project:
project
,
source_branch:
FFaker
::
Name
.
name
)
...
...
This diff is collapsed.
Click to expand it.
spec/helpers/issues_helper_spec.rb
View file @
5c7f9d69
This diff is collapsed.
Click to expand it.
spec/lib/gitlab/ci/config/entry/global_spec.rb
View file @
5c7f9d69
This diff is collapsed.
Click to expand it.
spec/lib/gitlab/ci/config/entry/job_spec.rb
View file @
5c7f9d69
This diff is collapsed.
Click to expand it.
spec/lib/gitlab/ci/status/build/factory_spec.rb
View file @
5c7f9d69
This diff is collapsed.
Click to expand it.
spec/lib/gitlab/incoming_email_spec.rb
View file @
5c7f9d69
This diff is collapsed.
Click to expand it.
spec/lib/gitlab/o_auth/user_spec.rb
View file @
5c7f9d69
This diff is collapsed.
Click to expand it.
spec/lib/gitlab/saml/user_spec.rb
View file @
5c7f9d69
This diff is collapsed.
Click to expand it.
spec/models/ci/build_spec.rb
View file @
5c7f9d69
This diff is collapsed.
Click to expand it.
spec/support/issuables_list_metadata_shared_examples.rb
View file @
5c7f9d69
...
...
@@ -3,7 +3,8 @@ shared_examples 'issuables list meta-data' do |issuable_type, action = nil|
@issuable_ids
=
[]
2
.
times
do
issuable
=
if
issuable_type
==
:issue
issuable
=
if
issuable_type
==
:issue
create
(
issuable_type
,
project:
project
)
else
create
(
issuable_type
,
title:
FFaker
::
Lorem
.
sentence
,
source_project:
project
,
source_branch:
FFaker
::
Name
.
name
)
...
...
This diff is collapsed.
Click to expand it.
spec/support/login_helpers.rb
View file @
5c7f9d69
...
...
@@ -15,7 +15,8 @@ module LoginHelpers
# user = create(:user)
# login_as(user)
def
login_as
(
user_or_role
)
@user
=
if
user_or_role
.
kind_of?
(
User
)
@user
=
if
user_or_role
.
kind_of?
(
User
)
user_or_role
else
create
(
user_or_role
)
...
...
This diff is collapsed.
Click to expand it.
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