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
e65b407a
Commit
e65b407a
authored
Jul 09, 2020
by
Igor Drozdov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable Style/RedundantReturn cop
This commit also fixes the existing offenses
parent
8e796698
Changes
27
Show whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
41 additions
and
52 deletions
+41
-52
.rubocop_todo.yml
.rubocop_todo.yml
+0
-6
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+2
-2
app/controllers/chaos_controller.rb
app/controllers/chaos_controller.rb
+0
-1
app/controllers/concerns/issuable_actions.rb
app/controllers/concerns/issuable_actions.rb
+2
-2
app/controllers/groups/application_controller.rb
app/controllers/groups/application_controller.rb
+4
-4
app/controllers/omniauth_callbacks_controller.rb
app/controllers/omniauth_callbacks_controller.rb
+1
-1
app/controllers/projects/application_controller.rb
app/controllers/projects/application_controller.rb
+1
-1
app/controllers/projects/blob_controller.rb
app/controllers/projects/blob_controller.rb
+1
-1
app/controllers/projects/releases_controller.rb
app/controllers/projects/releases_controller.rb
+1
-1
app/controllers/projects/tree_controller.rb
app/controllers/projects/tree_controller.rb
+2
-2
app/graphql/resolvers/projects/jira_projects_resolver.rb
app/graphql/resolvers/projects/jira_projects_resolver.rb
+1
-1
app/services/access_token_validation_service.rb
app/services/access_token_validation_service.rb
+5
-5
app/services/spam/spam_verdict_service.rb
app/services/spam/spam_verdict_service.rb
+1
-1
app/workers/delete_merged_branches_worker.rb
app/workers/delete_merged_branches_worker.rb
+0
-1
ee/app/helpers/ee/application_helper.rb
ee/app/helpers/ee/application_helper.rb
+1
-1
ee/app/services/epics/tree_reorder_service.rb
ee/app/services/epics/tree_reorder_service.rb
+1
-1
ee/lib/gitlab/geo/geo_node_status_check.rb
ee/lib/gitlab/geo/geo_node_status_check.rb
+1
-1
ee/lib/gitlab/geo/jwt_request_decoder.rb
ee/lib/gitlab/geo/jwt_request_decoder.rb
+1
-1
ee/lib/gitlab/graphql/aggregations/epics/lazy_epic_aggregate.rb
.../gitlab/graphql/aggregations/epics/lazy_epic_aggregate.rb
+1
-1
lib/gitlab/ci/pipeline/chain/validate/abilities.rb
lib/gitlab/ci/pipeline/chain/validate/abilities.rb
+1
-1
lib/gitlab/ci/pipeline/chain/validate/repository.rb
lib/gitlab/ci/pipeline/chain/validate/repository.rb
+1
-1
lib/gitlab/git_ref_validator.rb
lib/gitlab/git_ref_validator.rb
+2
-2
lib/gitlab/gitaly_client/repository_service.rb
lib/gitlab/gitaly_client/repository_service.rb
+2
-2
lib/gitlab/middleware/go.rb
lib/gitlab/middleware/go.rb
+2
-2
lib/gitlab/utils.rb
lib/gitlab/utils.rb
+1
-1
lib/google_api/auth.rb
lib/google_api/auth.rb
+1
-1
qa/qa/specs/features/ee/browser_ui/1_manage/group/group_file_template_spec.rb
.../ee/browser_ui/1_manage/group/group_file_template_spec.rb
+5
-8
No files found.
.rubocop_todo.yml
View file @
e65b407a
...
...
@@ -666,12 +666,6 @@ Style/RedundantFreeze:
Style/RedundantInterpolation
:
Enabled
:
false
# Offense count: 33
# Cop supports --auto-correct.
# Configuration parameters: AllowMultipleReturnValues.
Style/RedundantReturn
:
Enabled
:
false
# Offense count: 801
# Cop supports --auto-correct.
Style/RedundantSelf
:
...
...
app/controllers/application_controller.rb
View file @
e65b407a
...
...
@@ -306,7 +306,7 @@ class ApplicationController < ActionController::Base
return
if
session
[
:impersonator_id
]
||
!
current_user
&
.
allow_password_authentication?
if
current_user
&
.
password_expired?
re
turn
re
direct_to
new_profile_password_path
redirect_to
new_profile_password_path
end
end
...
...
@@ -364,7 +364,7 @@ class ApplicationController < ActionController::Base
def
require_email
if
current_user
&&
current_user
.
temp_oauth_email?
&&
session
[
:impersonator_id
].
nil?
re
turn
re
direct_to
profile_path
,
notice:
_
(
'Please complete your profile with email address'
)
redirect_to
profile_path
,
notice:
_
(
'Please complete your profile with email address'
)
end
end
...
...
app/controllers/chaos_controller.rb
View file @
e65b407a
...
...
@@ -45,7 +45,6 @@ class ChaosController < ActionController::Base
unless
Devise
.
secure_compare
(
chaos_secret_configured
,
chaos_secret_request
)
render
plain:
"To experience chaos, please set a valid `X-Chaos-Secret` header or `token` param"
,
status: :unauthorized
return
end
end
...
...
app/controllers/concerns/issuable_actions.rb
View file @
e65b407a
...
...
@@ -197,13 +197,13 @@ module IssuableActions
def
authorize_destroy_issuable!
unless
can?
(
current_user
,
:"destroy_
#{
issuable
.
to_ability_name
}
"
,
issuable
)
return
access_denied!
access_denied!
end
end
def
authorize_admin_issuable!
unless
can?
(
current_user
,
:"admin_
#{
resource_name
}
"
,
parent
)
return
access_denied!
access_denied!
end
end
...
...
app/controllers/groups/application_controller.rb
View file @
e65b407a
...
...
@@ -30,25 +30,25 @@ class Groups::ApplicationController < ApplicationController
def
authorize_admin_group!
unless
can?
(
current_user
,
:admin_group
,
group
)
re
turn
re
nder_404
render_404
end
end
def
authorize_create_deploy_token!
unless
can?
(
current_user
,
:create_deploy_token
,
group
)
re
turn
re
nder_404
render_404
end
end
def
authorize_destroy_deploy_token!
unless
can?
(
current_user
,
:destroy_deploy_token
,
group
)
re
turn
re
nder_404
render_404
end
end
def
authorize_admin_group_member!
unless
can?
(
current_user
,
:admin_group_member
,
group
)
re
turn
re
nder_403
render_403
end
end
...
...
app/controllers/omniauth_callbacks_controller.rb
View file @
e65b407a
...
...
@@ -200,7 +200,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
def
fail_login
(
user
)
error_message
=
user
.
errors
.
full_messages
.
to_sentence
re
turn
re
direct_to
omniauth_error_path
(
oauth
[
'provider'
],
error:
error_message
)
redirect_to
omniauth_error_path
(
oauth
[
'provider'
],
error:
error_message
)
end
def
fail_auth0_login
...
...
app/controllers/projects/application_controller.rb
View file @
e65b407a
...
...
@@ -42,7 +42,7 @@ class Projects::ApplicationController < ApplicationController
def
authorize_action!
(
action
)
unless
can?
(
current_user
,
action
,
project
)
return
access_denied!
access_denied!
end
end
...
...
app/controllers/projects/blob_controller.rb
View file @
e65b407a
...
...
@@ -129,7 +129,7 @@ class Projects::BlobController < Projects::ApplicationController
end
end
re
turn
re
direct_to_tree_root_for_missing_path
(
@project
,
@ref
,
@path
)
redirect_to_tree_root_for_missing_path
(
@project
,
@ref
,
@path
)
end
end
...
...
app/controllers/projects/releases_controller.rb
View file @
e65b407a
...
...
@@ -30,7 +30,7 @@ class Projects::ReleasesController < Projects::ApplicationController
def
new
unless
Feature
.
enabled?
(
:new_release_page
,
project
)
re
turn
re
direct_to
(
new_project_tag_path
(
@project
))
redirect_to
(
new_project_tag_path
(
@project
))
end
end
...
...
app/controllers/projects/tree_controller.rb
View file @
e65b407a
...
...
@@ -20,9 +20,9 @@ class Projects::TreeController < Projects::ApplicationController
if
tree
.
entries
.
empty?
if
@repository
.
blob_at
(
@commit
.
id
,
@path
)
re
turn
re
direct_to
project_blob_path
(
@project
,
File
.
join
(
@ref
,
@path
))
redirect_to
project_blob_path
(
@project
,
File
.
join
(
@ref
,
@path
))
elsif
@path
.
present?
re
turn
re
direct_to_tree_root_for_missing_path
(
@project
,
@ref
,
@path
)
redirect_to_tree_root_for_missing_path
(
@project
,
@ref
,
@path
)
end
end
end
...
...
app/graphql/resolvers/projects/jira_projects_resolver.rb
View file @
e65b407a
...
...
@@ -37,7 +37,7 @@ module Resolvers
def
jira_projects
(
name
:)
args
=
{
query:
name
}.
compact
return
Jira
::
Requests
::
Projects
::
ListService
.
new
(
project
.
jira_service
,
args
).
execute
Jira
::
Requests
::
Projects
::
ListService
.
new
(
project
.
jira_service
,
args
).
execute
end
end
end
...
...
app/services/access_token_validation_service.rb
View file @
e65b407a
...
...
@@ -17,21 +17,21 @@ class AccessTokenValidationService
def
validate
(
scopes:
[])
if
token
.
expired?
return
EXPIRED
EXPIRED
elsif
token
.
revoked?
return
REVOKED
REVOKED
elsif
!
self
.
include_any_scope?
(
scopes
)
return
INSUFFICIENT_SCOPE
INSUFFICIENT_SCOPE
elsif
token
.
respond_to?
(
:impersonation
)
&&
token
.
impersonation
&&
!
Gitlab
.
config
.
gitlab
.
impersonation_enabled
return
IMPERSONATION_DISABLED
IMPERSONATION_DISABLED
else
return
VALID
VALID
end
end
...
...
app/services/spam/spam_verdict_service.rb
View file @
e65b407a
...
...
@@ -57,7 +57,7 @@ module Spam
rescue
*
Gitlab
::
HTTP
::
HTTP_ERRORS
=>
e
# @TODO: log error via try_post https://gitlab.com/gitlab-org/gitlab/-/issues/219223
Gitlab
::
ErrorTracking
.
log_exception
(
e
)
return
nil
rescue
# @TODO log
ALLOW
...
...
app/workers/delete_merged_branches_worker.rb
View file @
e65b407a
...
...
@@ -17,7 +17,6 @@ class DeleteMergedBranchesWorker # rubocop:disable Scalability/IdempotentWorker
begin
::
Branches
::
DeleteMergedService
.
new
(
project
,
user
).
execute
rescue
Gitlab
::
Access
::
AccessDeniedError
return
end
end
end
ee/app/helpers/ee/application_helper.rb
View file @
e65b407a
...
...
@@ -33,7 +33,7 @@ module EE
if
unprocessed_too_old?
minutes_behind
=
time_ago_in_words
(
next_unprocessed_event
.
created_at
)
return
(
s_
(
'Geo|The node is currently %{minutes_behind} behind the primary node.'
)
%
(
s_
(
'Geo|The node is currently %{minutes_behind} behind the primary node.'
)
%
{
minutes_behind:
minutes_behind
}).
html_safe
end
end
...
...
ee/app/services/epics/tree_reorder_service.rb
View file @
e65b407a
...
...
@@ -74,7 +74,7 @@ module Epics
return
'Relative position is not valid.'
unless
valid_relative_position?
if
different_epic_parent?
return
"The sibling object's parent must match the
#{
new_parent
?
"new"
:
"current"
}
parent epic."
"The sibling object's parent must match the
#{
new_parent
?
"new"
:
"current"
}
parent epic."
end
end
...
...
ee/lib/gitlab/geo/geo_node_status_check.rb
View file @
e65b407a
...
...
@@ -57,7 +57,7 @@ module Gitlab
end
def
replication_verification_complete?
re
turn
re
plication_complete?
&&
verification_complete?
replication_complete?
&&
verification_complete?
end
private
...
...
ee/lib/gitlab/geo/jwt_request_decoder.rb
View file @
e65b407a
...
...
@@ -84,7 +84,7 @@ module Gitlab
raise
InvalidSignatureTimeError
.
new
(
message
)
rescue
JWT
::
DecodeError
=>
e
log_error
(
"Error decoding Geo request:
#{
e
}
"
)
return
nil
end
end
...
...
ee/lib/gitlab/graphql/aggregations/epics/lazy_epic_aggregate.rb
View file @
e65b407a
...
...
@@ -57,7 +57,7 @@ module Gitlab
end
unless
PERMITTED_FACETS
.
include?
(
aggregate_facet
.
to_sym
)
return
"Invalid aggregate facet
#{
aggregate_facet
}
provided."
"Invalid aggregate facet
#{
aggregate_facet
}
provided."
end
end
...
...
lib/gitlab/ci/pipeline/chain/validate/abilities.rb
View file @
e65b407a
...
...
@@ -19,7 +19,7 @@ module Gitlab
end
unless
allowed_to_write_ref?
return
error
(
"Insufficient permissions for protected ref '
#{
command
.
ref
}
'"
)
error
(
"Insufficient permissions for protected ref '
#{
command
.
ref
}
'"
)
end
end
...
...
lib/gitlab/ci/pipeline/chain/validate/repository.rb
View file @
e65b407a
...
...
@@ -18,7 +18,7 @@ module Gitlab
end
if
@command
.
ambiguous_ref?
return
error
(
'Ref is ambiguous'
)
error
(
'Ref is ambiguous'
)
end
end
...
...
lib/gitlab/git_ref_validator.rb
View file @
e65b407a
...
...
@@ -19,7 +19,7 @@ module Gitlab
begin
Rugged
::
Reference
.
valid_name?
(
"refs/heads/
#{
ref_name
}
"
)
rescue
ArgumentError
return
false
false
end
end
...
...
@@ -35,7 +35,7 @@ module Gitlab
begin
Rugged
::
Reference
.
valid_name?
(
expanded_name
)
rescue
ArgumentError
return
false
false
end
end
end
...
...
lib/gitlab/gitaly_client/repository_service.rb
View file @
e65b407a
...
...
@@ -201,9 +201,9 @@ module Gitlab
response
=
GitalyClient
.
call
(
@storage
,
:repository_service
,
:fsck
,
request
,
timeout:
GitalyClient
.
long_timeout
)
if
response
.
error
.
empty?
return
""
,
0
[
""
,
0
]
else
return
response
.
error
.
b
,
1
[
response
.
error
.
b
,
1
]
end
end
...
...
lib/gitlab/middleware/go.rb
View file @
e65b407a
...
...
@@ -101,7 +101,7 @@ module Gitlab
if
project
# If a project is found and the user has access, we return the full project path
return
project
.
full_path
,
project
.
default_branch
[
project
.
full_path
,
project
.
default_branch
]
else
# If not, we return the first two components as if it were a simple `namespace/project` path,
# so that we don't reveal the existence of a nested project the user doesn't have access to.
...
...
@@ -112,7 +112,7 @@ module Gitlab
# `go get gitlab.com/group/subgroup/project/subpackage` will not work for private projects.
# `go get gitlab.com/group/subgroup/project.git/subpackage` will work, since Go is smart enough
# to figure that out. `import 'gitlab.com/...'` behaves the same as `go get`.
return
simple_project_path
,
'master'
[
simple_project_path
,
'master'
]
end
end
...
...
lib/gitlab/utils.rb
View file @
e65b407a
...
...
@@ -56,7 +56,7 @@ module Gitlab
# * Maximum length is 63 bytes
# * First/Last Character is not a hyphen
def
slugify
(
str
)
return
str
.
downcase
str
.
downcase
.
gsub
(
/[^a-z0-9]/
,
'-'
)[
0
..
62
]
.
gsub
(
/(\A-+|-+\z)/
,
''
)
end
...
...
lib/google_api/auth.rb
View file @
e65b407a
...
...
@@ -22,7 +22,7 @@ module GoogleApi
def
get_token
(
code
)
ret
=
client
.
auth_code
.
get_token
(
code
,
redirect_uri:
redirect_uri
)
return
ret
.
token
,
ret
.
expires_at
[
ret
.
token
,
ret
.
expires_at
]
end
protected
...
...
qa/qa/specs/features/ee/browser_ui/1_manage/group/group_file_template_spec.rb
View file @
e65b407a
...
...
@@ -121,17 +121,14 @@ module QA
def
set_file_template_if_not_already_set
response
=
get
Runtime
::
API
::
Request
.
new
(
@api_client
,
"/groups/
#{
@group
.
id
}
"
).
url
if
parse_body
(
response
)[
:file_template_project_id
]
return
else
return
if
parse_body
(
response
)[
:file_template_project_id
]
@group
.
visit!
Page
::
Group
::
Menu
.
perform
(
&
:click_group_general_settings_item
)
Page
::
Group
::
Settings
::
General
.
perform
do
|
general
|
general
.
choose_file_template_repository
(
@file_template_project
.
name
)
end
end
end
def
remove_group_file_template_if_set
response
=
get
Runtime
::
API
::
Request
.
new
(
@api_client
,
"/groups/
#{
@group
.
id
}
"
).
url
...
...
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