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
bae9a502
Commit
bae9a502
authored
Mar 17, 2021
by
Shubham Kumar
Committed by
Peter Leitzen
Mar 17, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve Layout/BeginEndAlignment offenses
Resolves auto-correctable Rubocop offenses
parent
636c36aa
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
95 additions
and
108 deletions
+95
-108
.rubocop_todo.yml
.rubocop_todo.yml
+0
-18
app/controllers/groups/shared_projects_controller.rb
app/controllers/groups/shared_projects_controller.rb
+7
-7
app/workers/concerns/reactive_cacheable_worker.rb
app/workers/concerns/reactive_cacheable_worker.rb
+4
-4
changelogs/unreleased/pl-rubocop-todo-begin-end-alignment.yml
...gelogs/unreleased/pl-rubocop-todo-begin-end-alignment.yml
+5
-0
ee/app/services/security/token_revocation_service.rb
ee/app/services/security/token_revocation_service.rb
+17
-17
ee/lib/gitlab/analytics/cycle_analytics/summary/group/deploy.rb
.../gitlab/analytics/cycle_analytics/summary/group/deploy.rb
+6
-6
ee/lib/gitlab/ci/config/entry/vault/secret.rb
ee/lib/gitlab/ci/config/entry/vault/secret.rb
+9
-9
lib/api/internal/base.rb
lib/api/internal/base.rb
+14
-14
lib/atlassian/jira_connect/serializers/build_entity.rb
lib/atlassian/jira_connect/serializers/build_entity.rb
+5
-5
lib/gitlab/ci/jwt.rb
lib/gitlab/ci/jwt.rb
+8
-8
lib/gitlab/external_authorization/client.rb
lib/gitlab/external_authorization/client.rb
+10
-10
lib/gitlab/phabricator_import/project_creator.rb
lib/gitlab/phabricator_import/project_creator.rb
+5
-5
scripts/gitaly_test.rb
scripts/gitaly_test.rb
+5
-5
No files found.
.rubocop_todo.yml
View file @
bae9a502
...
@@ -32,24 +32,6 @@ Graphql/IDType:
...
@@ -32,24 +32,6 @@ Graphql/IDType:
Layout/ArgumentAlignment
:
Layout/ArgumentAlignment
:
Enabled
:
false
Enabled
:
false
# Offense count: 11
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyleAlignWith, Severity.
# SupportedStylesAlignWith: start_of_line, begin
Layout/BeginEndAlignment
:
Exclude
:
-
'
app/controllers/groups/shared_projects_controller.rb'
-
'
app/workers/concerns/reactive_cacheable_worker.rb'
-
'
ee/app/services/security/token_revocation_service.rb'
-
'
ee/lib/gitlab/analytics/cycle_analytics/summary/group/deploy.rb'
-
'
ee/lib/gitlab/ci/config/entry/vault/secret.rb'
-
'
lib/api/internal/base.rb'
-
'
lib/atlassian/jira_connect/serializers/build_entity.rb'
-
'
lib/gitlab/ci/jwt.rb'
-
'
lib/gitlab/external_authorization/client.rb'
-
'
lib/gitlab/phabricator_import/project_creator.rb'
-
'
scripts/gitaly_test.rb'
# Offense count: 54
# Offense count: 54
# Cop supports --auto-correct.
# Cop supports --auto-correct.
# Configuration parameters: AllowAliasSyntax, AllowedMethods.
# Configuration parameters: AllowAliasSyntax, AllowedMethods.
...
...
app/controllers/groups/shared_projects_controller.rb
View file @
bae9a502
...
@@ -25,13 +25,13 @@ module Groups
...
@@ -25,13 +25,13 @@ module Groups
def
finder_params
def
finder_params
@finder_params
||=
begin
@finder_params
||=
begin
# Make the `search` param consistent for the frontend,
# Make the `search` param consistent for the frontend,
# which will be using `filter`.
# which will be using `filter`.
params
[
:search
]
||=
params
[
:filter
]
if
params
[
:filter
]
params
[
:search
]
||=
params
[
:filter
]
if
params
[
:filter
]
# Don't show archived projects
# Don't show archived projects
params
[
:non_archived
]
=
true
params
[
:non_archived
]
=
true
params
.
permit
(
:sort
,
:search
,
:non_archived
)
params
.
permit
(
:sort
,
:search
,
:non_archived
)
end
end
end
end
end
end
end
end
app/workers/concerns/reactive_cacheable_worker.rb
View file @
bae9a502
...
@@ -17,10 +17,10 @@ module ReactiveCacheableWorker
...
@@ -17,10 +17,10 @@ module ReactiveCacheableWorker
def
perform
(
class_name
,
id
,
*
args
)
def
perform
(
class_name
,
id
,
*
args
)
klass
=
begin
klass
=
begin
class_name
.
constantize
class_name
.
constantize
rescue
NameError
rescue
NameError
nil
nil
end
end
return
unless
klass
return
unless
klass
...
...
changelogs/unreleased/pl-rubocop-todo-begin-end-alignment.yml
0 → 100644
View file @
bae9a502
---
title
:
Fixed offenses Layout/BeginEndAlignment
merge_request
:
56827
author
:
Shubham Kumar (@imskr)
type
:
fixed
ee/app/services/security/token_revocation_service.rb
View file @
bae9a502
...
@@ -57,23 +57,23 @@ module Security
...
@@ -57,23 +57,23 @@ module Security
def
revoke_token_body
def
revoke_token_body
@revoke_token_body
||=
begin
@revoke_token_body
||=
begin
response
=
::
Gitlab
::
HTTP
.
get
(
response
=
::
Gitlab
::
HTTP
.
get
(
token_types_url
,
token_types_url
,
headers:
{
headers:
{
'Content-Type'
=>
'application/json'
,
'Content-Type'
=>
'application/json'
,
'Authorization'
=>
revocation_api_token
'Authorization'
=>
revocation_api_token
}
}
)
)
raise
RevocationFailedError
,
'Failed to get revocation token types'
unless
response
.
success?
raise
RevocationFailedError
,
'Failed to get revocation token types'
unless
response
.
success?
token_types
=
::
Gitlab
::
Json
.
parse
(
response
.
body
)[
'types'
]
token_types
=
::
Gitlab
::
Json
.
parse
(
response
.
body
)[
'types'
]
return
if
token_types
.
blank?
return
if
token_types
.
blank?
@revocable_keys
.
filter!
{
|
key
|
token_types
.
include?
(
key
[
:type
])
}
@revocable_keys
.
filter!
{
|
key
|
token_types
.
include?
(
key
[
:type
])
}
return
if
@revocable_keys
.
blank?
return
if
@revocable_keys
.
blank?
@revocable_keys
.
to_json
@revocable_keys
.
to_json
end
end
end
end
def
token_types_url
def
token_types_url
...
...
ee/lib/gitlab/analytics/cycle_analytics/summary/group/deploy.rb
View file @
bae9a502
...
@@ -21,13 +21,13 @@ module Gitlab
...
@@ -21,13 +21,13 @@ module Gitlab
# rubocop: disable CodeReuse/ActiveRecord
# rubocop: disable CodeReuse/ActiveRecord
def
deployments_count
def
deployments_count
@deployments_count
||=
begin
@deployments_count
||=
begin
deployments
=
DeploymentsFinder
deployments
=
DeploymentsFinder
.
new
(
group:
group
,
finished_after:
options
[
:from
],
finished_before:
options
[
:to
],
status: :success
)
.
new
(
group:
group
,
finished_after:
options
[
:from
],
finished_before:
options
[
:to
],
status: :success
)
.
execute
.
execute
deployments
=
deployments
.
where
(
project_id:
options
[
:projects
])
if
options
[
:projects
].
present?
deployments
=
deployments
.
where
(
project_id:
options
[
:projects
])
if
options
[
:projects
].
present?
deployments
.
count
deployments
.
count
end
end
end
end
# rubocop: enable CodeReuse/ActiveRecord
# rubocop: enable CodeReuse/ActiveRecord
end
end
...
...
ee/lib/gitlab/ci/config/entry/vault/secret.rb
View file @
bae9a502
...
@@ -40,15 +40,15 @@ module Gitlab
...
@@ -40,15 +40,15 @@ module Gitlab
def
secret
def
secret
@secret
||=
begin
@secret
||=
begin
secret
,
engine_path
=
secret_and_engine
secret
,
engine_path
=
secret_and_engine
secret_path
,
_
,
secret_field
=
secret
.
rpartition
(
'/'
)
secret_path
,
_
,
secret_field
=
secret
.
rpartition
(
'/'
)
{
{
engine_path:
engine_path
,
engine_path:
engine_path
,
secret_path:
secret_path
,
secret_path:
secret_path
,
secret_field:
secret_field
secret_field:
secret_field
}
}
end
end
end
end
def
secret_and_engine
def
secret_and_engine
...
...
lib/api/internal/base.rb
View file @
bae9a502
...
@@ -52,20 +52,20 @@ module API
...
@@ -52,20 +52,20 @@ module API
actor
.
update_last_used_at!
actor
.
update_last_used_at!
check_result
=
begin
check_result
=
begin
Gitlab
::
Auth
::
CurrentUserMode
.
bypass_session!
(
actor
.
user
&
.
id
)
do
Gitlab
::
Auth
::
CurrentUserMode
.
bypass_session!
(
actor
.
user
&
.
id
)
do
access_check!
(
actor
,
params
)
access_check!
(
actor
,
params
)
end
end
rescue
Gitlab
::
GitAccess
::
ForbiddenError
=>
e
rescue
Gitlab
::
GitAccess
::
ForbiddenError
=>
e
# The return code needs to be 401. If we return 403
# The return code needs to be 401. If we return 403
# the custom message we return won't be shown to the user
# the custom message we return won't be shown to the user
# and, instead, the default message 'GitLab: API is not accessible'
# and, instead, the default message 'GitLab: API is not accessible'
# will be displayed
# will be displayed
return
response_with_status
(
code:
401
,
success:
false
,
message:
e
.
message
)
return
response_with_status
(
code:
401
,
success:
false
,
message:
e
.
message
)
rescue
Gitlab
::
GitAccess
::
TimeoutError
=>
e
rescue
Gitlab
::
GitAccess
::
TimeoutError
=>
e
return
response_with_status
(
code:
503
,
success:
false
,
message:
e
.
message
)
return
response_with_status
(
code:
503
,
success:
false
,
message:
e
.
message
)
rescue
Gitlab
::
GitAccess
::
NotFoundError
=>
e
rescue
Gitlab
::
GitAccess
::
NotFoundError
=>
e
return
response_with_status
(
code:
404
,
success:
false
,
message:
e
.
message
)
return
response_with_status
(
code:
404
,
success:
false
,
message:
e
.
message
)
end
end
log_user_activity
(
actor
.
user
)
log_user_activity
(
actor
.
user
)
...
...
lib/atlassian/jira_connect/serializers/build_entity.rb
View file @
bae9a502
...
@@ -25,11 +25,11 @@ module Atlassian
...
@@ -25,11 +25,11 @@ module Atlassian
# extract Jira issue keys from either the source branch/ref or the
# extract Jira issue keys from either the source branch/ref or the
# merge request title.
# merge request title.
@issue_keys
||=
begin
@issue_keys
||=
begin
pipeline
.
all_merge_requests
.
flat_map
do
|
mr
|
pipeline
.
all_merge_requests
.
flat_map
do
|
mr
|
src
=
"
#{
mr
.
source_branch
}
#{
mr
.
title
}
"
src
=
"
#{
mr
.
source_branch
}
#{
mr
.
title
}
"
JiraIssueKeyExtractor
.
new
(
src
).
issue_keys
JiraIssueKeyExtractor
.
new
(
src
).
issue_keys
end
.
uniq
end
.
uniq
end
end
end
end
private
private
...
...
lib/gitlab/ci/jwt.rb
View file @
bae9a502
...
@@ -72,16 +72,16 @@ module Gitlab
...
@@ -72,16 +72,16 @@ module Gitlab
def
key
def
key
@key
||=
begin
@key
||=
begin
key_data
=
if
Feature
.
enabled?
(
:ci_jwt_signing_key
,
build
.
project
,
default_enabled:
true
)
key_data
=
if
Feature
.
enabled?
(
:ci_jwt_signing_key
,
build
.
project
,
default_enabled:
true
)
Gitlab
::
CurrentSettings
.
ci_jwt_signing_key
Gitlab
::
CurrentSettings
.
ci_jwt_signing_key
else
else
Rails
.
application
.
secrets
.
openid_connect_signing_key
Rails
.
application
.
secrets
.
openid_connect_signing_key
end
end
raise
NoSigningKeyError
unless
key_data
raise
NoSigningKeyError
unless
key_data
OpenSSL
::
PKey
::
RSA
.
new
(
key_data
)
OpenSSL
::
PKey
::
RSA
.
new
(
key_data
)
end
end
end
end
def
public_key
def
public_key
...
...
lib/gitlab/external_authorization/client.rb
View file @
bae9a502
...
@@ -51,18 +51,18 @@ module Gitlab
...
@@ -51,18 +51,18 @@ module Gitlab
def
body
def
body
@body
||=
begin
@body
||=
begin
body
=
{
body
=
{
user_identifier:
@user
.
email
,
user_identifier:
@user
.
email
,
project_classification_label:
@label
,
project_classification_label:
@label
,
identities:
@user
.
identities
.
map
{
|
identity
|
{
provider:
identity
.
provider
,
extern_uid:
identity
.
extern_uid
}
}
identities:
@user
.
identities
.
map
{
|
identity
|
{
provider:
identity
.
provider
,
extern_uid:
identity
.
extern_uid
}
}
}
}
if
@user
.
ldap_identity
if
@user
.
ldap_identity
body
[
:user_ldap_dn
]
=
@user
.
ldap_identity
.
extern_uid
body
[
:user_ldap_dn
]
=
@user
.
ldap_identity
.
extern_uid
end
end
body
body
end
end
end
end
end
end
end
end
...
...
lib/gitlab/phabricator_import/project_creator.rb
View file @
bae9a502
...
@@ -56,11 +56,11 @@ module Gitlab
...
@@ -56,11 +56,11 @@ module Gitlab
def
project_feature_attributes
def
project_feature_attributes
@project_features_attributes
||=
begin
@project_features_attributes
||=
begin
# everything disabled except for issues
# everything disabled except for issues
ProjectFeature
::
FEATURES
.
map
do
|
feature
|
ProjectFeature
::
FEATURES
.
map
do
|
feature
|
[
ProjectFeature
.
access_level_attribute
(
feature
),
ProjectFeature
::
DISABLED
]
[
ProjectFeature
.
access_level_attribute
(
feature
),
ProjectFeature
::
DISABLED
]
end
.
to_h
.
merge
(
ProjectFeature
.
access_level_attribute
(
:issues
)
=>
ProjectFeature
::
ENABLED
)
end
.
to_h
.
merge
(
ProjectFeature
.
access_level_attribute
(
:issues
)
=>
ProjectFeature
::
ENABLED
)
end
end
end
end
def
import_data
def
import_data
...
...
scripts/gitaly_test.rb
View file @
bae9a502
...
@@ -12,11 +12,11 @@ require 'logger'
...
@@ -12,11 +12,11 @@ require 'logger'
module
GitalyTest
module
GitalyTest
LOGGER
=
begin
LOGGER
=
begin
default_name
=
ENV
[
'CI'
]
?
'DEBUG'
:
'WARN'
default_name
=
ENV
[
'CI'
]
?
'DEBUG'
:
'WARN'
level_name
=
ENV
[
'GITLAB_TESTING_LOG_LEVEL'
]
&
.
upcase
level_name
=
ENV
[
'GITLAB_TESTING_LOG_LEVEL'
]
&
.
upcase
level
=
Logger
.
const_get
(
level_name
||
default_name
,
true
)
# rubocop: disable Gitlab/ConstGetInheritFalse
level
=
Logger
.
const_get
(
level_name
||
default_name
,
true
)
# rubocop: disable Gitlab/ConstGetInheritFalse
Logger
.
new
(
STDOUT
,
level:
level
,
formatter:
->
(
_
,
_
,
_
,
msg
)
{
msg
})
Logger
.
new
(
STDOUT
,
level:
level
,
formatter:
->
(
_
,
_
,
_
,
msg
)
{
msg
})
end
end
def
tmp_tests_gitaly_dir
def
tmp_tests_gitaly_dir
File
.
expand_path
(
'../tmp/tests/gitaly'
,
__dir__
)
File
.
expand_path
(
'../tmp/tests/gitaly'
,
__dir__
)
...
...
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