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