Resolve Naming/UncommunicativeMethod
This commit is contained in:
parent
9286f5b934
commit
3bfe306624
|
|
@ -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(msg, *args, &block)
|
||||
@commit.__send__(msg, *args, &block) # rubocop:disable GitlabSecurity/PublicSend
|
||||
end
|
||||
|
||||
def space
|
||||
|
|
|
|||
|
|
@ -462,12 +462,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(msg, *args, &block)
|
||||
if msg == :lookup && !block_given?
|
||||
lookup_cache[msg] ||= {}
|
||||
lookup_cache[msg][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__(msg, *args, &block) # rubocop:disable GitlabSecurity/PublicSend
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1333,8 +1333,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, &block)
|
||||
scope.first || create_unique_internal(scope, username, email_pattern, &block)
|
||||
end
|
||||
|
||||
def self.create_unique_internal(scope, username, email_pattern, &creation_block)
|
||||
|
|
|
|||
|
|
@ -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(*args)
|
||||
Builder::Default.new(*args).notification_recipients
|
||||
end
|
||||
|
||||
def self.build_new_note_recipients(*a)
|
||||
Builder::NewNote.new(*a).notification_recipients
|
||||
def self.build_new_note_recipients(*args)
|
||||
Builder::NewNote.new(*args).notification_recipients
|
||||
end
|
||||
|
||||
def self.build_merge_request_unmergeable_recipients(*a)
|
||||
Builder::MergeRequestUnmergeable.new(*a).notification_recipients
|
||||
def self.build_merge_request_unmergeable_recipients(*args)
|
||||
Builder::MergeRequestUnmergeable.new(*args).notification_recipients
|
||||
end
|
||||
|
||||
module Builder
|
||||
|
|
|
|||
|
|
@ -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, error)
|
||||
Rails.logger.warn("Email can not be processed: #{error}\n\n#{raw}")
|
||||
|
||||
return unless raw.present?
|
||||
|
||||
can_retry = false
|
||||
reason =
|
||||
case e
|
||||
case error
|
||||
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
|
||||
error.message
|
||||
end
|
||||
|
||||
if reason
|
||||
|
|
|
|||
|
|
@ -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(&block)
|
||||
rule = RuleDsl.new(self).instance_eval(&block)
|
||||
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, *args)
|
||||
runner(ability).debug(*args)
|
||||
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
|
||||
|
|
|
|||
|
|
@ -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(msg, *args)
|
||||
return super unless args.empty? && !block_given?
|
||||
|
||||
@rule_dsl.delegate(@delegate_name, m)
|
||||
@rule_dsl.delegate(@delegate_name, msg)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ module DeclarativePolicy
|
|||
@rule = rule
|
||||
end
|
||||
|
||||
def policy(&b)
|
||||
instance_eval(&b)
|
||||
def policy(&block)
|
||||
instance_eval(&block)
|
||||
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(msg, *args, &block)
|
||||
return super unless @context_class.respond_to?(msg)
|
||||
|
||||
@context_class.__send__(m, *a, &b) # rubocop:disable GitlabSecurity/PublicSend
|
||||
@context_class.__send__(msg, *args, &block) # rubocop:disable GitlabSecurity/PublicSend
|
||||
end
|
||||
|
||||
def respond_to_missing?(m)
|
||||
@context_class.respond_to?(m) || super
|
||||
def respond_to_missing?(msg)
|
||||
@context_class.respond_to?(msg) || super
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -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(&block)
|
||||
with_preferred_scope(:user, &block)
|
||||
end
|
||||
|
||||
def subject_scope(&b)
|
||||
with_preferred_scope(:subject, &b)
|
||||
def subject_scope(&block)
|
||||
with_preferred_scope(:subject, &block)
|
||||
end
|
||||
|
||||
def preferred_scope=(scope)
|
||||
|
|
|
|||
|
|
@ -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(*args)
|
||||
new(*args).simplify
|
||||
end
|
||||
|
||||
# true or false whether this rule passes.
|
||||
|
|
|
|||
|
|
@ -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(msg, *args)
|
||||
return super unless args.empty? && !block_given?
|
||||
|
||||
if @context_class.delegations.key?(m)
|
||||
DelegateDsl.new(self, m)
|
||||
if @context_class.delegations.key?(msg)
|
||||
DelegateDsl.new(self, msg)
|
||||
else
|
||||
cond(m.to_sym)
|
||||
cond(msg.to_sym)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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(stack) 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(stack) 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(scanner)
|
||||
action = scanner[1]
|
||||
timestamp = scanner[2]
|
||||
section = scanner[3]
|
||||
line = scanner.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(scanner)
|
||||
indicator = scanner[1]
|
||||
commands = scanner[2].split ';'
|
||||
terminator = scanner[3]
|
||||
|
||||
# We are only interested in color and text style changes - triggered by
|
||||
# sequences starting with '\e[' and ending with 'm'. Any other control
|
||||
|
|
|
|||
|
|
@ -75,19 +75,19 @@ module Gitlab
|
|||
@beginning_of_section_regex ||= /section_/.freeze
|
||||
end
|
||||
|
||||
def find_next_marker(s)
|
||||
def find_next_marker(scanner)
|
||||
beginning_of_section_len = 8
|
||||
maybe_marker = s.exist?(beginning_of_section_regex)
|
||||
maybe_marker = scanner.exist?(beginning_of_section_regex)
|
||||
|
||||
if maybe_marker.nil?
|
||||
s.terminate
|
||||
scanner.terminate
|
||||
else
|
||||
# repositioning at the beginning of the match
|
||||
s.pos += maybe_marker - beginning_of_section_len
|
||||
scanner.pos += maybe_marker - beginning_of_section_len
|
||||
if block_given?
|
||||
good_marker = yield(s)
|
||||
good_marker = yield(scanner)
|
||||
# if not a good marker: Consuming the matched beginning_of_section_regex
|
||||
s.pos += beginning_of_section_len unless good_marker
|
||||
scanner.pos += beginning_of_section_len unless good_marker
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -68,14 +68,14 @@ module Gitlab
|
|||
nil
|
||||
end
|
||||
|
||||
def encode_binary(s)
|
||||
return "" if s.nil?
|
||||
def encode_binary(str)
|
||||
return "" if str.nil?
|
||||
|
||||
s.dup.force_encoding(Encoding::ASCII_8BIT)
|
||||
str.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(str)
|
||||
StringIO.new(str || '').tap { |io| io.set_encoding(Encoding::ASCII_8BIT) }
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
|||
|
|
@ -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(str)
|
||||
str = str.gsub(/([Ii]ssue) ([0-9]+)/, '\1 #\2')
|
||||
str = str.gsub(/([Cc]ase) ([0-9]+)/, '\1 #\2')
|
||||
str
|
||||
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(str)
|
||||
str = str.gsub(/^#/, "\\#")
|
||||
str = str.gsub(/^-/, "\\-")
|
||||
str = str.gsub("`", "\\~")
|
||||
str = str.delete("\r")
|
||||
str = str.gsub("\n", " \n")
|
||||
str
|
||||
end
|
||||
|
||||
def format_content(raw_content)
|
||||
|
|
|
|||
|
|
@ -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(time)
|
||||
Google::Protobuf::Timestamp.new(seconds: time.to_i)
|
||||
end
|
||||
|
||||
# The default timeout on all Gitaly calls
|
||||
|
|
|
|||
|
|
@ -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(array)
|
||||
Google::Protobuf::RepeatedField.new(:bytes, array.map { |s| encode_binary(s) } )
|
||||
end
|
||||
|
||||
def call_find_commit(revision)
|
||||
|
|
|
|||
|
|
@ -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(msg, *args, &block)
|
||||
@hash.public_send(msg, *args, &block) # rubocop:disable GitlabSecurity/PublicSend
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -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(str)
|
||||
str = str.gsub(/([Ii]ssue) ([0-9]+)/, '\1 #\2')
|
||||
str = str.gsub(/([Cc]omment) #([0-9]+)/, '\1 \2')
|
||||
str
|
||||
end
|
||||
|
||||
def escape_for_markdown(s)
|
||||
def escape_for_markdown(str)
|
||||
# No headings and lists
|
||||
s = s.gsub(/^#/, "\\#")
|
||||
s = s.gsub(/^-/, "\\-")
|
||||
str = str.gsub(/^#/, "\\#")
|
||||
str = str.gsub(/^-/, "\\-")
|
||||
|
||||
# No inline code
|
||||
s = s.gsub("`", "\\`")
|
||||
str = str.gsub("`", "\\`")
|
||||
|
||||
# Carriage returns make me sad
|
||||
s = s.delete("\r")
|
||||
str = str.delete("\r")
|
||||
|
||||
# Markdown ignores single newlines, but we need them as <br />.
|
||||
s = s.gsub("\n", " \n")
|
||||
str = str.gsub("\n", " \n")
|
||||
|
||||
s
|
||||
str
|
||||
end
|
||||
|
||||
def create_label(name)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ describe MigrateGcpClustersToNewClustersArchitectures, :migration do
|
|||
end
|
||||
end
|
||||
|
||||
def tr(s)
|
||||
s.delete("'")
|
||||
def tr(str)
|
||||
str.delete("'")
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue