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
6d0654f3
Commit
6d0654f3
authored
Feb 23, 2022
by
Siddharth Asthana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve Performance/DeletePrefix rubocop offenses
Changelog: other EE: true
parent
0e060c73
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
14 additions
and
13 deletions
+14
-13
app/helpers/submodule_helper.rb
app/helpers/submodule_helper.rb
+1
-1
ee/lib/gitlab/geo/git_ssh_proxy.rb
ee/lib/gitlab/geo/git_ssh_proxy.rb
+2
-2
lib/banzai/filter/repository_link_filter.rb
lib/banzai/filter/repository_link_filter.rb
+1
-1
lib/gitlab/auth/ldap/dn.rb
lib/gitlab/auth/ldap/dn.rb
+1
-1
lib/gitlab/gfm/uploads_rewriter.rb
lib/gitlab/gfm/uploads_rewriter.rb
+1
-1
lib/gitlab/git/ref.rb
lib/gitlab/git/ref.rb
+1
-1
lib/gitlab/project_template.rb
lib/gitlab/project_template.rb
+1
-1
lib/gitlab/setup_helper.rb
lib/gitlab/setup_helper.rb
+1
-1
lib/gitlab/time_tracking_formatter.rb
lib/gitlab/time_tracking_formatter.rb
+3
-2
spec/controllers/projects/artifacts_controller_spec.rb
spec/controllers/projects/artifacts_controller_spec.rb
+1
-1
spec/lib/gitlab/gfm/uploads_rewriter_spec.rb
spec/lib/gitlab/gfm/uploads_rewriter_spec.rb
+1
-1
No files found.
app/helpers/submodule_helper.rb
View file @
6d0654f3
...
@@ -30,7 +30,7 @@ module SubmoduleHelper
...
@@ -30,7 +30,7 @@ module SubmoduleHelper
end
end
end
end
namespace
.
sub!
(
%r{
\A
/}
,
'
'
)
namespace
.
delete_prefix!
(
'/
'
)
project
.
rstrip!
project
.
rstrip!
project
.
delete_suffix!
(
'.git'
)
project
.
delete_suffix!
(
'.git'
)
...
...
ee/lib/gitlab/geo/git_ssh_proxy.rb
View file @
6d0654f3
...
@@ -173,7 +173,7 @@ module Gitlab
...
@@ -173,7 +173,7 @@ module Gitlab
# https://git-scm.com/book/en/v2/Git-Internals-Transfer-Protocols
# https://git-scm.com/book/en/v2/Git-Internals-Transfer-Protocols
#
#
def
remove_upload_pack_http_service_fragment_from
(
body
)
def
remove_upload_pack_http_service_fragment_from
(
body
)
body
.
gsub
(
/\A001e# service=git-upload-pack\n0000/
,
''
)
body
.
delete_prefix
(
"001e# service=git-upload-pack
\n
0000"
)
end
end
# See Uploading Data > HTTP(S) section at:
# See Uploading Data > HTTP(S) section at:
...
@@ -195,7 +195,7 @@ module Gitlab
...
@@ -195,7 +195,7 @@ module Gitlab
# https://git-scm.com/book/en/v2/Git-Internals-Transfer-Protocols
# https://git-scm.com/book/en/v2/Git-Internals-Transfer-Protocols
#
#
def
remove_receive_pack_http_service_fragment_from
(
body
)
def
remove_receive_pack_http_service_fragment_from
(
body
)
body
.
gsub
(
/\A001f# service=git-receive-pack\n0000/
,
''
)
body
.
delete_prefix
(
"001f# service=git-receive-pack
\n
0000"
)
end
end
def
ensure_secondary!
def
ensure_secondary!
...
...
lib/banzai/filter/repository_link_filter.rb
View file @
6d0654f3
...
@@ -180,7 +180,7 @@ module Banzai
...
@@ -180,7 +180,7 @@ module Banzai
parts
.
pop
if
uri_type
(
request_path
)
!=
:tree
parts
.
pop
if
uri_type
(
request_path
)
!=
:tree
path
.
sub!
(
%r{
\A\.
/}
,
'
'
)
path
.
delete_prefix!
(
'./
'
)
while
path
.
start_with?
(
'../'
)
while
path
.
start_with?
(
'../'
)
parts
.
pop
parts
.
pop
...
...
lib/gitlab/auth/ldap/dn.rb
View file @
6d0654f3
...
@@ -30,7 +30,7 @@ module Gitlab
...
@@ -30,7 +30,7 @@ module Gitlab
def
self
.
normalize_value
(
given_value
)
def
self
.
normalize_value
(
given_value
)
dummy_dn
=
"placeholder=
#{
given_value
}
"
dummy_dn
=
"placeholder=
#{
given_value
}
"
normalized_dn
=
new
(
*
dummy_dn
).
to_normalized_s
normalized_dn
=
new
(
*
dummy_dn
).
to_normalized_s
normalized_dn
.
sub
(
/\Aplaceholder=/
,
'
'
)
normalized_dn
.
delete_prefix
(
'placeholder=
'
)
end
end
##
##
...
...
lib/gitlab/gfm/uploads_rewriter.rb
View file @
6d0654f3
...
@@ -37,7 +37,7 @@ module Gitlab
...
@@ -37,7 +37,7 @@ module Gitlab
if
was_embedded?
(
markdown
)
if
was_embedded?
(
markdown
)
moved_markdown
moved_markdown
else
else
moved_markdown
.
sub
(
/\A!/
,
""
)
moved_markdown
.
delete_prefix
(
'!'
)
end
end
end
end
end
end
...
...
lib/gitlab/git/ref.rb
View file @
6d0654f3
...
@@ -24,7 +24,7 @@ module Gitlab
...
@@ -24,7 +24,7 @@ module Gitlab
# Ex.
# Ex.
# Ref.extract_branch_name('refs/heads/master') #=> 'master'
# Ref.extract_branch_name('refs/heads/master') #=> 'master'
def
self
.
extract_branch_name
(
str
)
def
self
.
extract_branch_name
(
str
)
str
.
gsub
(
%r{
\A
refs/heads/}
,
'
'
)
str
.
delete_prefix
(
'refs/heads/
'
)
end
end
def
initialize
(
repository
,
name
,
target
,
dereferenced_target
)
def
initialize
(
repository
,
name
,
target
,
dereferenced_target
)
...
...
lib/gitlab/project_template.rb
View file @
6d0654f3
...
@@ -29,7 +29,7 @@ module Gitlab
...
@@ -29,7 +29,7 @@ module Gitlab
end
end
def
project_path
def
project_path
URI
.
parse
(
preview
).
path
.
sub
(
%r{
\A
/}
,
'
'
)
URI
.
parse
(
preview
).
path
.
delete_prefix
(
'/
'
)
end
end
def
uri_encoded_project_path
def
uri_encoded_project_path
...
...
lib/gitlab/setup_helper.rb
View file @
6d0654f3
...
@@ -98,7 +98,7 @@ module Gitlab
...
@@ -98,7 +98,7 @@ module Gitlab
storages
<<
{
name:
key
,
path:
storage_paths
[
key
]
}
storages
<<
{
name:
key
,
path:
storage_paths
[
key
]
}
end
end
config
=
{
socket_path:
address
.
sub
(
/\Aunix:/
,
'
'
)
}
config
=
{
socket_path:
address
.
delete_prefix
(
'unix:
'
)
}
if
Rails
.
env
.
test?
if
Rails
.
env
.
test?
socket_filename
=
options
[
:gitaly_socket
]
||
"gitaly.socket"
socket_filename
=
options
[
:gitaly_socket
]
||
"gitaly.socket"
...
...
lib/gitlab/time_tracking_formatter.rb
View file @
6d0654f3
...
@@ -8,7 +8,8 @@ module Gitlab
...
@@ -8,7 +8,8 @@ module Gitlab
CUSTOM_DAY_AND_MONTH_LENGTH
=
{
hours_per_day:
8
,
days_per_month:
20
}.
freeze
CUSTOM_DAY_AND_MONTH_LENGTH
=
{
hours_per_day:
8
,
days_per_month:
20
}.
freeze
def
parse
(
string
)
def
parse
(
string
)
string
=
string
.
sub
(
/\A-/
,
''
)
negative_time
=
string
.
start_with?
(
'-'
)
string
=
string
.
delete_prefix
(
'-'
)
seconds
=
seconds
=
begin
begin
...
@@ -19,7 +20,7 @@ module Gitlab
...
@@ -19,7 +20,7 @@ module Gitlab
nil
nil
end
end
seconds
*=
-
1
if
seconds
&&
Regexp
.
last_match
seconds
*=
-
1
if
seconds
&&
negative_time
seconds
seconds
end
end
...
...
spec/controllers/projects/artifacts_controller_spec.rb
View file @
6d0654f3
...
@@ -339,7 +339,7 @@ RSpec.describe Projects::ArtifactsController do
...
@@ -339,7 +339,7 @@ RSpec.describe Projects::ArtifactsController do
def
params
def
params
@params
||=
begin
@params
||=
begin
base64_params
=
send_data
.
sub
(
/\Aartifacts\-entry:/
,
'
'
)
base64_params
=
send_data
.
delete_prefix
(
'artifacts-entry:
'
)
Gitlab
::
Json
.
parse
(
Base64
.
urlsafe_decode64
(
base64_params
))
Gitlab
::
Json
.
parse
(
Base64
.
urlsafe_decode64
(
base64_params
))
end
end
end
end
...
...
spec/lib/gitlab/gfm/uploads_rewriter_spec.rb
View file @
6d0654f3
...
@@ -67,7 +67,7 @@ RSpec.describe Gitlab::Gfm::UploadsRewriter do
...
@@ -67,7 +67,7 @@ RSpec.describe Gitlab::Gfm::UploadsRewriter do
it
'does not rewrite plain links as embedded'
do
it
'does not rewrite plain links as embedded'
do
embedded_link
=
image_uploader
.
markdown_link
embedded_link
=
image_uploader
.
markdown_link
plain_image_link
=
embedded_link
.
sub
(
/\A!/
,
""
)
plain_image_link
=
embedded_link
.
delete_prefix
(
'!'
)
text
=
"
#{
plain_image_link
}
and
#{
embedded_link
}
"
text
=
"
#{
plain_image_link
}
and
#{
embedded_link
}
"
moved_text
=
described_class
.
new
(
text
,
old_project
,
user
).
rewrite
(
new_project
)
moved_text
=
described_class
.
new
(
text
,
old_project
,
user
).
rewrite
(
new_project
)
...
...
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