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
f49e2192
Commit
f49e2192
authored
Jul 04, 2018
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve Naming/UncommunicativeMethod
parent
dab0019e
Changes
26
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
156 additions
and
156 deletions
+156
-156
app/models/network/commit.rb
app/models/network/commit.rb
+2
-2
app/models/repository.rb
app/models/repository.rb
+5
-5
app/models/user.rb
app/models/user.rb
+2
-2
app/services/notification_recipient_service.rb
app/services/notification_recipient_service.rb
+6
-6
app/workers/email_receiver_worker.rb
app/workers/email_receiver_worker.rb
+4
-4
lib/declarative_policy/base.rb
lib/declarative_policy/base.rb
+5
-5
lib/declarative_policy/delegate_dsl.rb
lib/declarative_policy/delegate_dsl.rb
+3
-3
lib/declarative_policy/policy_dsl.rb
lib/declarative_policy/policy_dsl.rb
+7
-7
lib/declarative_policy/preferred_scope.rb
lib/declarative_policy/preferred_scope.rb
+5
-5
lib/declarative_policy/rule.rb
lib/declarative_policy/rule.rb
+2
-2
lib/declarative_policy/rule_dsl.rb
lib/declarative_policy/rule_dsl.rb
+5
-5
lib/declarative_policy/runner.rb
lib/declarative_policy/runner.rb
+1
-1
lib/gitlab/ci/ansi2html.rb
lib/gitlab/ci/ansi2html.rb
+59
-59
lib/gitlab/ci/trace/section_parser.rb
lib/gitlab/ci/trace/section_parser.rb
+6
-6
lib/gitlab/diff/image_point.rb
lib/gitlab/diff/image_point.rb
+3
-3
lib/gitlab/diff/inline_diff.rb
lib/gitlab/diff/inline_diff.rb
+2
-2
lib/gitlab/encoding_helper.rb
lib/gitlab/encoding_helper.rb
+5
-5
lib/gitlab/fogbugz_import/importer.rb
lib/gitlab/fogbugz_import/importer.rb
+11
-11
lib/gitlab/gitaly_client.rb
lib/gitlab/gitaly_client.rb
+2
-2
lib/gitlab/gitaly_client/commit_service.rb
lib/gitlab/gitaly_client/commit_service.rb
+2
-2
lib/gitlab/gitaly_client/storage_settings.rb
lib/gitlab/gitaly_client/storage_settings.rb
+2
-2
lib/gitlab/google_code_import/importer.rb
lib/gitlab/google_code_import/importer.rb
+11
-11
lib/rouge/formatters/html_gitlab.rb
lib/rouge/formatters/html_gitlab.rb
+1
-1
spec/migrations/migrate_gcp_clusters_to_new_clusters_architectures_spec.rb
...igrate_gcp_clusters_to_new_clusters_architectures_spec.rb
+2
-2
spec/support/helpers/key_generator_helper.rb
spec/support/helpers/key_generator_helper.rb
+1
-1
spec/workers/concerns/waitable_worker_spec.rb
spec/workers/concerns/waitable_worker_spec.rb
+2
-2
No files found.
app/models/network/commit.rb
View file @
f49e2192
...
...
@@ -11,8 +11,8 @@ module Network
@parent_spaces
=
[]
end
def
method_missing
(
m
,
*
args
,
&
block
)
@commit
.
__send__
(
m
,
*
args
,
&
block
)
# rubocop:disable GitlabSecurity/PublicSend
def
method_missing
(
m
sg
,
*
args
,
&
block
)
@commit
.
__send__
(
m
sg
,
*
args
,
&
block
)
# rubocop:disable GitlabSecurity/PublicSend
end
def
space
...
...
app/models/repository.rb
View file @
f49e2192
...
...
@@ -469,12 +469,12 @@ class Repository
expire_branches_cache
end
def
method_missing
(
m
,
*
args
,
&
block
)
if
m
==
:lookup
&&
!
block_given?
lookup_cache
[
m
]
||=
{}
lookup_cache
[
m
][
args
.
join
(
":"
)]
||=
raw_repository
.
__send__
(
m
,
*
args
,
&
block
)
# rubocop:disable GitlabSecurity/PublicSend
def
method_missing
(
m
sg
,
*
args
,
&
block
)
if
m
sg
==
:lookup
&&
!
block_given?
lookup_cache
[
m
sg
]
||=
{}
lookup_cache
[
m
sg
][
args
.
join
(
":"
)]
||=
raw_repository
.
__send__
(
msg
,
*
args
,
&
block
)
# rubocop:disable GitlabSecurity/PublicSend
else
raw_repository
.
__send__
(
m
,
*
args
,
&
block
)
# rubocop:disable GitlabSecurity/PublicSend
raw_repository
.
__send__
(
m
sg
,
*
args
,
&
block
)
# rubocop:disable GitlabSecurity/PublicSend
end
end
...
...
app/models/user.rb
View file @
f49e2192
...
...
@@ -1355,8 +1355,8 @@ class User < ActiveRecord::Base
end
end
def
self
.
unique_internal
(
scope
,
username
,
email_pattern
,
&
b
)
scope
.
first
||
create_unique_internal
(
scope
,
username
,
email_pattern
,
&
b
)
def
self
.
unique_internal
(
scope
,
username
,
email_pattern
,
&
b
lock
)
scope
.
first
||
create_unique_internal
(
scope
,
username
,
email_pattern
,
&
b
lock
)
end
def
self
.
create_unique_internal
(
scope
,
username
,
email_pattern
,
&
creation_block
)
...
...
app/services/notification_recipient_service.rb
View file @
f49e2192
...
...
@@ -10,16 +10,16 @@ module NotificationRecipientService
NotificationRecipient
.
new
(
user
,
*
args
).
notifiable?
end
def
self
.
build_recipients
(
*
a
)
Builder
::
Default
.
new
(
*
a
).
notification_recipients
def
self
.
build_recipients
(
*
a
rgs
)
Builder
::
Default
.
new
(
*
a
rgs
).
notification_recipients
end
def
self
.
build_new_note_recipients
(
*
a
)
Builder
::
NewNote
.
new
(
*
a
).
notification_recipients
def
self
.
build_new_note_recipients
(
*
a
rgs
)
Builder
::
NewNote
.
new
(
*
a
rgs
).
notification_recipients
end
def
self
.
build_merge_request_unmergeable_recipients
(
*
a
)
Builder
::
MergeRequestUnmergeable
.
new
(
*
a
).
notification_recipients
def
self
.
build_merge_request_unmergeable_recipients
(
*
a
rgs
)
Builder
::
MergeRequestUnmergeable
.
new
(
*
a
rgs
).
notification_recipients
end
module
Builder
...
...
app/workers/email_receiver_worker.rb
View file @
f49e2192
...
...
@@ -15,14 +15,14 @@ class EmailReceiverWorker
private
def
handle_failure
(
raw
,
e
)
Rails
.
logger
.
warn
(
"Email can not be processed:
#{
e
}
\n\n
#{
raw
}
"
)
def
handle_failure
(
raw
,
e
rror
)
Rails
.
logger
.
warn
(
"Email can not be processed:
#{
e
rror
}
\n\n
#{
raw
}
"
)
return
unless
raw
.
present?
can_retry
=
false
reason
=
case
e
case
e
rror
when
Gitlab
::
Email
::
UnknownIncomingEmail
"We couldn't figure out what the email is for. Please create your issue or comment through the web interface."
when
Gitlab
::
Email
::
SentNotificationNotFoundError
...
...
@@ -42,7 +42,7 @@ class EmailReceiverWorker
"The thread you are replying to no longer exists, perhaps it was deleted? If you believe this is in error, contact a staff member."
when
Gitlab
::
Email
::
InvalidRecordError
can_retry
=
true
e
.
message
e
rror
.
message
end
if
reason
...
...
lib/declarative_policy/base.rb
View file @
f49e2192
...
...
@@ -119,8 +119,8 @@ module DeclarativePolicy
# a PolicyDsl which is used for registering the rule with
# this class. PolicyDsl will call back into Base.enable_when,
# Base.prevent_when, and Base.prevent_all_when.
def
rule
(
&
b
)
rule
=
RuleDsl
.
new
(
self
).
instance_eval
(
&
b
)
def
rule
(
&
b
lock
)
rule
=
RuleDsl
.
new
(
self
).
instance_eval
(
&
b
lock
)
PolicyDsl
.
new
(
self
,
rule
)
end
...
...
@@ -222,8 +222,8 @@ module DeclarativePolicy
# computes the given ability and prints a helpful debugging output
# showing which
def
debug
(
ability
,
*
a
)
runner
(
ability
).
debug
(
*
a
)
def
debug
(
ability
,
*
a
rgs
)
runner
(
ability
).
debug
(
*
a
rgs
)
end
desc
"Unknown user"
...
...
@@ -274,7 +274,7 @@ module DeclarativePolicy
#
# NOTE we can't use ||= here because the value might be the
# boolean `false`
def
cache
(
key
,
&
b
)
def
cache
(
key
)
return
@cache
[
key
]
if
cached?
(
key
)
@cache
[
key
]
=
yield
...
...
lib/declarative_policy/delegate_dsl.rb
View file @
f49e2192
...
...
@@ -7,10 +7,10 @@ module DeclarativePolicy
@delegate_name
=
delegate_name
end
def
method_missing
(
m
,
*
a
,
&
b
)
return
super
unless
a
.
empty?
&&
!
block_given?
def
method_missing
(
m
sg
,
*
args
)
return
super
unless
a
rgs
.
empty?
&&
!
block_given?
@rule_dsl
.
delegate
(
@delegate_name
,
m
)
@rule_dsl
.
delegate
(
@delegate_name
,
m
sg
)
end
end
end
lib/declarative_policy/policy_dsl.rb
View file @
f49e2192
...
...
@@ -15,8 +15,8 @@ module DeclarativePolicy
@rule
=
rule
end
def
policy
(
&
b
)
instance_eval
(
&
b
)
def
policy
(
&
b
lock
)
instance_eval
(
&
b
lock
)
end
def
enable
(
*
abilities
)
...
...
@@ -31,14 +31,14 @@ module DeclarativePolicy
@context_class
.
prevent_all_when
(
@rule
)
end
def
method_missing
(
m
,
*
a
,
&
b
)
return
super
unless
@context_class
.
respond_to?
(
m
)
def
method_missing
(
m
sg
,
*
args
,
&
block
)
return
super
unless
@context_class
.
respond_to?
(
m
sg
)
@context_class
.
__send__
(
m
,
*
a
,
&
b
)
# rubocop:disable GitlabSecurity/PublicSend
@context_class
.
__send__
(
m
sg
,
*
args
,
&
block
)
# rubocop:disable GitlabSecurity/PublicSend
end
def
respond_to_missing?
(
m
)
@context_class
.
respond_to?
(
m
)
||
super
def
respond_to_missing?
(
m
sg
)
@context_class
.
respond_to?
(
m
sg
)
||
super
end
end
end
lib/declarative_policy/preferred_scope.rb
View file @
f49e2192
...
...
@@ -2,7 +2,7 @@ module DeclarativePolicy # rubocop:disable Naming/FileName
PREFERRED_SCOPE_KEY
=
:"DeclarativePolicy.preferred_scope"
class
<<
self
def
with_preferred_scope
(
scope
,
&
b
)
def
with_preferred_scope
(
scope
)
Thread
.
current
[
PREFERRED_SCOPE_KEY
],
old_scope
=
scope
,
Thread
.
current
[
PREFERRED_SCOPE_KEY
]
yield
ensure
...
...
@@ -13,12 +13,12 @@ module DeclarativePolicy # rubocop:disable Naming/FileName
Thread
.
current
[
PREFERRED_SCOPE_KEY
]
end
def
user_scope
(
&
b
)
with_preferred_scope
(
:user
,
&
b
)
def
user_scope
(
&
b
lock
)
with_preferred_scope
(
:user
,
&
b
lock
)
end
def
subject_scope
(
&
b
)
with_preferred_scope
(
:subject
,
&
b
)
def
subject_scope
(
&
b
lock
)
with_preferred_scope
(
:subject
,
&
b
lock
)
end
def
preferred_scope
=
(
scope
)
...
...
lib/declarative_policy/rule.rb
View file @
f49e2192
...
...
@@ -8,8 +8,8 @@ module DeclarativePolicy
# how that affects the actual ability decision - for that, a
# `Step` is used.
class
Base
def
self
.
make
(
*
a
)
new
(
*
a
).
simplify
def
self
.
make
(
*
a
rgs
)
new
(
*
a
rgs
).
simplify
end
# true or false whether this rule passes.
...
...
lib/declarative_policy/rule_dsl.rb
View file @
f49e2192
...
...
@@ -32,13 +32,13 @@ module DeclarativePolicy
Rule
::
DelegatedCondition
.
new
(
delegate_name
,
condition
)
end
def
method_missing
(
m
,
*
a
,
&
b
)
return
super
unless
a
.
empty?
&&
!
block_given?
def
method_missing
(
m
sg
,
*
args
)
return
super
unless
a
rgs
.
empty?
&&
!
block_given?
if
@context_class
.
delegations
.
key?
(
m
)
DelegateDsl
.
new
(
self
,
m
)
if
@context_class
.
delegations
.
key?
(
m
sg
)
DelegateDsl
.
new
(
self
,
m
sg
)
else
cond
(
m
.
to_sym
)
cond
(
m
sg
.
to_sym
)
end
end
end
...
...
lib/declarative_policy/runner.rb
View file @
f49e2192
...
...
@@ -127,7 +127,7 @@ module DeclarativePolicy
#
# For each step, we yield the step object along with the computed score
# for debugging purposes.
def
steps_by_score
(
&
b
)
def
steps_by_score
flatten_steps!
if
@steps
.
size
>
50
...
...
lib/gitlab/ci/ansi2html.rb
View file @
f49e2192
...
...
@@ -29,105 +29,105 @@ module Gitlab
end
class
Converter
def
on_0
(
s
)
reset
()
end
def
on_0
(
_
)
reset
()
end
def
on_1
(
s
)
enable
(
STYLE_SWITCHES
[
:bold
])
end
def
on_1
(
_
)
enable
(
STYLE_SWITCHES
[
:bold
])
end
def
on_3
(
s
)
enable
(
STYLE_SWITCHES
[
:italic
])
end
def
on_3
(
_
)
enable
(
STYLE_SWITCHES
[
:italic
])
end
def
on_4
(
s
)
enable
(
STYLE_SWITCHES
[
:underline
])
end
def
on_4
(
_
)
enable
(
STYLE_SWITCHES
[
:underline
])
end
def
on_8
(
s
)
enable
(
STYLE_SWITCHES
[
:conceal
])
end
def
on_8
(
_
)
enable
(
STYLE_SWITCHES
[
:conceal
])
end
def
on_9
(
s
)
enable
(
STYLE_SWITCHES
[
:cross
])
end
def
on_9
(
_
)
enable
(
STYLE_SWITCHES
[
:cross
])
end
def
on_21
(
s
)
disable
(
STYLE_SWITCHES
[
:bold
])
end
def
on_21
(
_
)
disable
(
STYLE_SWITCHES
[
:bold
])
end
def
on_22
(
s
)
disable
(
STYLE_SWITCHES
[
:bold
])
end
def
on_22
(
_
)
disable
(
STYLE_SWITCHES
[
:bold
])
end
def
on_23
(
s
)
disable
(
STYLE_SWITCHES
[
:italic
])
end
def
on_23
(
_
)
disable
(
STYLE_SWITCHES
[
:italic
])
end
def
on_24
(
s
)
disable
(
STYLE_SWITCHES
[
:underline
])
end
def
on_24
(
_
)
disable
(
STYLE_SWITCHES
[
:underline
])
end
def
on_28
(
s
)
disable
(
STYLE_SWITCHES
[
:conceal
])
end
def
on_28
(
_
)
disable
(
STYLE_SWITCHES
[
:conceal
])
end
def
on_29
(
s
)
disable
(
STYLE_SWITCHES
[
:cross
])
end
def
on_29
(
_
)
disable
(
STYLE_SWITCHES
[
:cross
])
end
def
on_30
(
s
)
set_fg_color
(
0
)
end
def
on_30
(
_
)
set_fg_color
(
0
)
end
def
on_31
(
s
)
set_fg_color
(
1
)
end
def
on_31
(
_
)
set_fg_color
(
1
)
end
def
on_32
(
s
)
set_fg_color
(
2
)
end
def
on_32
(
_
)
set_fg_color
(
2
)
end
def
on_33
(
s
)
set_fg_color
(
3
)
end
def
on_33
(
_
)
set_fg_color
(
3
)
end
def
on_34
(
s
)
set_fg_color
(
4
)
end
def
on_34
(
_
)
set_fg_color
(
4
)
end
def
on_35
(
s
)
set_fg_color
(
5
)
end
def
on_35
(
_
)
set_fg_color
(
5
)
end
def
on_36
(
s
)
set_fg_color
(
6
)
end
def
on_36
(
_
)
set_fg_color
(
6
)
end
def
on_37
(
s
)
set_fg_color
(
7
)
end
def
on_37
(
_
)
set_fg_color
(
7
)
end
def
on_38
(
s
)
set_fg_color_256
(
s
)
end
def
on_38
(
s
tack
)
set_fg_color_256
(
stack
)
end
def
on_39
(
s
)
set_fg_color
(
9
)
end
def
on_39
(
_
)
set_fg_color
(
9
)
end
def
on_40
(
s
)
set_bg_color
(
0
)
end
def
on_40
(
_
)
set_bg_color
(
0
)
end
def
on_41
(
s
)
set_bg_color
(
1
)
end
def
on_41
(
_
)
set_bg_color
(
1
)
end
def
on_42
(
s
)
set_bg_color
(
2
)
end
def
on_42
(
_
)
set_bg_color
(
2
)
end
def
on_43
(
s
)
set_bg_color
(
3
)
end
def
on_43
(
_
)
set_bg_color
(
3
)
end
def
on_44
(
s
)
set_bg_color
(
4
)
end
def
on_44
(
_
)
set_bg_color
(
4
)
end
def
on_45
(
s
)
set_bg_color
(
5
)
end
def
on_45
(
_
)
set_bg_color
(
5
)
end
def
on_46
(
s
)
set_bg_color
(
6
)
end
def
on_46
(
_
)
set_bg_color
(
6
)
end
def
on_47
(
s
)
set_bg_color
(
7
)
end
def
on_47
(
_
)
set_bg_color
(
7
)
end
def
on_48
(
s
)
set_bg_color_256
(
s
)
end
def
on_48
(
s
tack
)
set_bg_color_256
(
stack
)
end
def
on_49
(
s
)
set_bg_color
(
9
)
end
def
on_49
(
_
)
set_bg_color
(
9
)
end
def
on_90
(
s
)
set_fg_color
(
0
,
'l'
)
end
def
on_90
(
_
)
set_fg_color
(
0
,
'l'
)
end
def
on_91
(
s
)
set_fg_color
(
1
,
'l'
)
end
def
on_91
(
_
)
set_fg_color
(
1
,
'l'
)
end
def
on_92
(
s
)
set_fg_color
(
2
,
'l'
)
end
def
on_92
(
_
)
set_fg_color
(
2
,
'l'
)
end
def
on_93
(
s
)
set_fg_color
(
3
,
'l'
)
end
def
on_93
(
_
)
set_fg_color
(
3
,
'l'
)
end
def
on_94
(
s
)
set_fg_color
(
4
,
'l'
)
end
def
on_94
(
_
)
set_fg_color
(
4
,
'l'
)
end
def
on_95
(
s
)
set_fg_color
(
5
,
'l'
)
end
def
on_95
(
_
)
set_fg_color
(
5
,
'l'
)
end
def
on_96
(
s
)
set_fg_color
(
6
,
'l'
)
end
def
on_96
(
_
)
set_fg_color
(
6
,
'l'
)
end
def
on_97
(
s
)
set_fg_color
(
7
,
'l'
)
end
def
on_97
(
_
)
set_fg_color
(
7
,
'l'
)
end
def
on_99
(
s
)
set_fg_color
(
9
,
'l'
)
end
def
on_99
(
_
)
set_fg_color
(
9
,
'l'
)
end
def
on_100
(
s
)
set_bg_color
(
0
,
'l'
)
end
def
on_100
(
_
)
set_bg_color
(
0
,
'l'
)
end
def
on_101
(
s
)
set_bg_color
(
1
,
'l'
)
end
def
on_101
(
_
)
set_bg_color
(
1
,
'l'
)
end
def
on_102
(
s
)
set_bg_color
(
2
,
'l'
)
end
def
on_102
(
_
)
set_bg_color
(
2
,
'l'
)
end
def
on_103
(
s
)
set_bg_color
(
3
,
'l'
)
end
def
on_103
(
_
)
set_bg_color
(
3
,
'l'
)
end
def
on_104
(
s
)
set_bg_color
(
4
,
'l'
)
end
def
on_104
(
_
)
set_bg_color
(
4
,
'l'
)
end
def
on_105
(
s
)
set_bg_color
(
5
,
'l'
)
end
def
on_105
(
_
)
set_bg_color
(
5
,
'l'
)
end
def
on_106
(
s
)
set_bg_color
(
6
,
'l'
)
end
def
on_106
(
_
)
set_bg_color
(
6
,
'l'
)
end
def
on_107
(
s
)
set_bg_color
(
7
,
'l'
)
end
def
on_107
(
_
)
set_bg_color
(
7
,
'l'
)
end
def
on_109
(
s
)
set_bg_color
(
9
,
'l'
)
end
def
on_109
(
_
)
set_bg_color
(
9
,
'l'
)
end
attr_accessor
:offset
,
:n_open_tags
,
:fg_color
,
:bg_color
,
:style_mask
...
...
@@ -188,19 +188,19 @@ module Gitlab
)
end
def
handle_section
(
s
)
action
=
s
[
1
]
timestamp
=
s
[
2
]
section
=
s
[
3
]
line
=
s
.
matched
()[
0
...-
5
]
# strips \r\033[0K
def
handle_section
(
s
canner
)
action
=
s
canner
[
1
]
timestamp
=
s
canner
[
2
]
section
=
s
canner
[
3
]
line
=
s
canner
.
matched
()[
0
...-
5
]
# strips \r\033[0K
@out
<<
%{<div class="hidden" data-action="#{action}" data-timestamp="#{timestamp}" data-section="#{section}">#{line}</div>}
end
def
handle_sequence
(
s
)
indicator
=
s
[
1
]
commands
=
s
[
2
].
split
';'
terminator
=
s
[
3
]
def
handle_sequence
(
s
canner
)
indicator
=
s
canner
[
1
]
commands
=
s
canner
[
2
].
split
';'
terminator
=
s
canner
[
3
]
# We are only interested in color and text style changes - triggered by
# sequences starting with '\e[' and ending with 'm'. Any other control
...
...
lib/gitlab/ci/trace/section_parser.rb
View file @
f49e2192
...
...
@@ -75,19 +75,19 @@ module Gitlab
@beginning_of_section_regex
||=
/section_/
.
freeze
end
def
find_next_marker
(
s
)
def
find_next_marker
(
s
canner
)
beginning_of_section_len
=
8
maybe_marker
=
s
.
exist?
(
beginning_of_section_regex
)
maybe_marker
=
s
canner
.
exist?
(
beginning_of_section_regex
)
if
maybe_marker
.
nil?
s
.
terminate
s
canner
.
terminate
else
# repositioning at the beginning of the match
s
.
pos
+=
maybe_marker
-
beginning_of_section_len
s
canner
.
pos
+=
maybe_marker
-
beginning_of_section_len
if
block_given?
good_marker
=
yield
(
s
)
good_marker
=
yield
(
s
canner
)
# if not a good marker: Consuming the matched beginning_of_section_regex
s
.
pos
+=
beginning_of_section_len
unless
good_marker
s
canner
.
pos
+=
beginning_of_section_len
unless
good_marker
end
end
end
...
...
lib/gitlab/diff/image_point.rb
View file @
f49e2192
...
...
@@ -3,11 +3,11 @@ module Gitlab
class
ImagePoint
attr_reader
:width
,
:height
,
:x
,
:y
def
initialize
(
width
,
height
,
x
,
y
)
def
initialize
(
width
,
height
,
new_x
,
new_
y
)
@width
=
width
@height
=
height
@x
=
x
@y
=
y
@x
=
new_
x
@y
=
new_
y
end
def
to_h
...
...
lib/gitlab/diff/inline_diff.rb
View file @
f49e2192
...
...
@@ -93,7 +93,7 @@ module Gitlab
private
def
longest_common_prefix
(
a
,
b
)
def
longest_common_prefix
(
a
,
b
)
# rubocop:disable Naming/UncommunicativeMethodParamName
max_length
=
[
a
.
length
,
b
.
length
].
max
length
=
0
...
...
@@ -109,7 +109,7 @@ module Gitlab
length
end
def
longest_common_suffix
(
a
,
b
)
def
longest_common_suffix
(
a
,
b
)
# rubocop:disable Naming/UncommunicativeMethodParamName
longest_common_prefix
(
a
.
reverse
,
b
.
reverse
)
end
end
...
...
lib/gitlab/encoding_helper.rb
View file @
f49e2192
...
...
@@ -68,14 +68,14 @@ module Gitlab
nil
end
def
encode_binary
(
s
)
return
""
if
s
.
nil?
def
encode_binary
(
s
tr
)
return
""
if
s
tr
.
nil?
s
.
dup
.
force_encoding
(
Encoding
::
ASCII_8BIT
)
s
tr
.
dup
.
force_encoding
(
Encoding
::
ASCII_8BIT
)
end
def
binary_stringio
(
s
)
StringIO
.
new
(
s
||
''
).
tap
{
|
io
|
io
.
set_encoding
(
Encoding
::
ASCII_8BIT
)
}
def
binary_stringio
(
s
tr
)
StringIO
.
new
(
s
tr
||
''
).
tap
{
|
io
|
io
.
set_encoding
(
Encoding
::
ASCII_8BIT
)
}
end
private
...
...
lib/gitlab/fogbugz_import/importer.rb
View file @
f49e2192
...
...
@@ -191,19 +191,19 @@ module Gitlab
end
end
def
linkify_issues
(
s
)
s
=
s
.
gsub
(
/([Ii]ssue) ([0-9]+)/
,
'\1 #\2'
)
s
=
s
.
gsub
(
/([Cc]ase) ([0-9]+)/
,
'\1 #\2'
)
s
def
linkify_issues
(
s
tr
)
s
tr
=
str
.
gsub
(
/([Ii]ssue) ([0-9]+)/
,
'\1 #\2'
)
s
tr
=
str
.
gsub
(
/([Cc]ase) ([0-9]+)/
,
'\1 #\2'
)
s
tr
end
def
escape_for_markdown
(
s
)
s
=
s
.
gsub
(
/^#/
,
"
\\
#"
)
s
=
s
.
gsub
(
/^-/
,
"
\\
-"
)
s
=
s
.
gsub
(
"`"
,
"
\\
~"
)
s
=
s
.
delete
(
"
\r
"
)
s
=
s
.
gsub
(
"
\n
"
,
"
\n
"
)
s
def
escape_for_markdown
(
s
tr
)
s
tr
=
str
.
gsub
(
/^#/
,
"
\\
#"
)
s
tr
=
str
.
gsub
(
/^-/
,
"
\\
-"
)
s
tr
=
str
.
gsub
(
"`"
,
"
\\
~"
)
s
tr
=
str
.
delete
(
"
\r
"
)
s
tr
=
str
.
gsub
(
"
\n
"
,
"
\n
"
)
s
tr
end
def
format_content
(
raw_content
)
...
...
lib/gitlab/gitaly_client.rb
View file @
f49e2192
...
...
@@ -401,8 +401,8 @@ module Gitlab
path
.
read
.
chomp
end
def
self
.
timestamp
(
t
)
Google
::
Protobuf
::
Timestamp
.
new
(
seconds:
t
.
to_i
)
def
self
.
timestamp
(
t
ime
)
Google
::
Protobuf
::
Timestamp
.
new
(
seconds:
t
ime
.
to_i
)
end
# The default timeout on all Gitaly calls
...
...
lib/gitlab/gitaly_client/commit_service.rb
View file @
f49e2192
...
...
@@ -399,8 +399,8 @@ module Gitlab
end
end
def
encode_repeated
(
a
)
Google
::
Protobuf
::
RepeatedField
.
new
(
:bytes
,
a
.
map
{
|
s
|
encode_binary
(
s
)
}
)
def
encode_repeated
(
a
rray
)
Google
::
Protobuf
::
RepeatedField
.
new
(
:bytes
,
a
rray
.
map
{
|
s
|
encode_binary
(
s
)
}
)
end
def
call_find_commit
(
revision
)
...
...
lib/gitlab/gitaly_client/storage_settings.rb
View file @
f49e2192
...
...
@@ -60,8 +60,8 @@ module Gitlab
private
def
method_missing
(
m
,
*
args
,
&
block
)
@hash
.
public_send
(
m
,
*
args
,
&
block
)
# rubocop:disable GitlabSecurity/PublicSend
def
method_missing
(
m
sg
,
*
args
,
&
block
)
@hash
.
public_send
(
m
sg
,
*
args
,
&
block
)
# rubocop:disable GitlabSecurity/PublicSend
end
end
end
...
...
lib/gitlab/google_code_import/importer.rb
View file @
f49e2192
...
...
@@ -200,27 +200,27 @@ module Gitlab
"Status:
#{
name
}
"
end
def
linkify_issues
(
s
)
s
=
s
.
gsub
(
/([Ii]ssue) ([0-9]+)/
,
'\1 #\2'
)
s
=
s
.
gsub
(
/([Cc]omment) #([0-9]+)/
,
'\1 \2'
)
s
def
linkify_issues
(
s
tr
)
s
tr
=
str
.
gsub
(
/([Ii]ssue) ([0-9]+)/
,
'\1 #\2'
)
s
tr
=
str
.
gsub
(
/([Cc]omment) #([0-9]+)/
,
'\1 \2'
)
s
tr
end
def
escape_for_markdown
(
s
)
def
escape_for_markdown
(
s
tr
)
# No headings and lists
s
=
s
.
gsub
(
/^#/
,
"
\\
#"
)
s
=
s
.
gsub
(
/^-/
,
"
\\
-"
)
s
tr
=
str
.
gsub
(
/^#/
,
"
\\
#"
)
s
tr
=
str
.
gsub
(
/^-/
,
"
\\
-"
)
# No inline code
s
=
s
.
gsub
(
"`"
,
"
\\
`"
)
s
tr
=
str
.
gsub
(
"`"
,
"
\\
`"
)
# Carriage returns make me sad
s
=
s
.
delete
(
"
\r
"
)
s
tr
=
str
.
delete
(
"
\r
"
)
# Markdown ignores single newlines, but we need them as <br />.
s
=
s
.
gsub
(
"
\n
"
,
"
\n
"
)
s
tr
=
str
.
gsub
(
"
\n
"
,
"
\n
"
)
s
s
tr
end
def
create_label
(
name
)
...
...
lib/rouge/formatters/html_gitlab.rb
View file @
f49e2192
...
...
@@ -11,7 +11,7 @@ module Rouge
@tag
=
tag
end
def
stream
(
tokens
,
&
b
)
def
stream
(
tokens
)
is_first
=
true
token_lines
(
tokens
)
do
|
line
|
yield
"
\n
"
unless
is_first
...
...
spec/migrations/migrate_gcp_clusters_to_new_clusters_architectures_spec.rb
View file @
f49e2192
...
...
@@ -175,7 +175,7 @@ describe MigrateGcpClustersToNewClustersArchitectures, :migration do
end
end
def
tr
(
s
)
s
.
delete
(
"'"
)
def
tr
(
s
tr
)
s
tr
.
delete
(
"'"
)
end
end
spec/support/helpers/key_generator_helper.rb
View file @
f49e2192
...
...
@@ -24,7 +24,7 @@ module Spec
private
# Encodes an openssh-mpi-encoded integer.
def
encode_mpi
(
n
)
def
encode_mpi
(
n
)
# rubocop:disable Naming/UncommunicativeMethodParamName
chars
,
n
=
[],
n
.
to_i
chars
<<
(
n
&
0xff
)
&&
n
>>=
8
while
n
!=
0
chars
<<
0
if
chars
.
empty?
||
chars
.
last
>=
0x80
...
...
spec/workers/concerns/waitable_worker_spec.rb
View file @
f49e2192
...
...
@@ -18,8 +18,8 @@ describe WaitableWorker do
def
self
.
bulk_perform_inline
(
args_list
)
end
def
perform
(
i
=
0
)
self
.
class
.
counter
+=
i
def
perform
(
count
=
0
)
self
.
class
.
counter
+=
count
end
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