Fix all rubocop warnings
This commit is contained in:
parent
05e39dc619
commit
bf851133ae
48 changed files with 124 additions and 97 deletions
|
@ -13,7 +13,7 @@ module ActivityPub::CaseTransform
|
|||
when Symbol then camel_lower(value.to_s).to_sym
|
||||
when String
|
||||
camel_lower_cache[value] ||= if value.start_with?('_:')
|
||||
'_:' + value.gsub(/\A_:/, '').underscore.camelize(:lower)
|
||||
"_:#{value.gsub(/\A_:/, '').underscore.camelize(:lower)}"
|
||||
else
|
||||
value.underscore.camelize(:lower)
|
||||
end
|
||||
|
|
|
@ -62,7 +62,7 @@ class EmojiFormatter
|
|||
end
|
||||
end
|
||||
|
||||
result << html[last_index..-1]
|
||||
result << html[last_index..]
|
||||
|
||||
result.html_safe # rubocop:disable Rails/OutputSafety
|
||||
end
|
||||
|
|
|
@ -29,7 +29,7 @@ module Extractor
|
|||
|
||||
text.scan(Account::MENTION_RE) do |screen_name, _|
|
||||
match_data = $LAST_MATCH_INFO
|
||||
after = $'
|
||||
after = Regexp.last_match.post_match
|
||||
|
||||
unless Twitter::TwitterText::Regex[:end_mention_match].match?(after)
|
||||
_, domain = screen_name.split('@')
|
||||
|
@ -64,7 +64,7 @@ module Extractor
|
|||
match_data = $LAST_MATCH_INFO
|
||||
start_position = match_data.char_begin(1) - 1
|
||||
end_position = match_data.char_end(1)
|
||||
after = $'
|
||||
after = Regexp.last_match.post_match
|
||||
|
||||
if %r{\A://}.match?(after)
|
||||
hash_text.match(/(.+)(https?\Z)/) do |matched|
|
||||
|
|
|
@ -7,8 +7,8 @@ class RedisConfiguration
|
|||
@pool = ConnectionPool.new(size: new_pool_size) { new.connection }
|
||||
end
|
||||
|
||||
def with
|
||||
pool.with { |redis| yield redis }
|
||||
def with(&block)
|
||||
pool.with(&block)
|
||||
end
|
||||
|
||||
def pool
|
||||
|
|
|
@ -64,7 +64,7 @@ class TextFormatter
|
|||
indices.last
|
||||
end
|
||||
|
||||
result << h(text[last_index..-1])
|
||||
result << h(text[last_index..])
|
||||
|
||||
result
|
||||
end
|
||||
|
@ -75,8 +75,8 @@ class TextFormatter
|
|||
|
||||
prefix = url.match(URL_PREFIX_REGEX).to_s
|
||||
display_url = url[prefix.length, 30]
|
||||
suffix = url[prefix.length + 30..-1]
|
||||
cutoff = url[prefix.length..-1].length > 30
|
||||
suffix = url[prefix.length + 30..]
|
||||
cutoff = url[prefix.length..].length > 30
|
||||
|
||||
<<~HTML.squish
|
||||
<a href="#{h(url)}" target="_blank" rel="#{rel.join(' ')}"><span class="invisible">#{h(prefix)}</span><span class="#{cutoff ? 'ellipsis' : ''}">#{h(display_url)}</span><span class="invisible">#{h(suffix)}</span></a>
|
||||
|
|
|
@ -53,7 +53,7 @@ class TOCGenerator
|
|||
|
||||
next unless LISTED_ELEMENTS.include?(node.name)
|
||||
|
||||
depth = node.name[1..-1]
|
||||
depth = node.name[1..]
|
||||
latest_section = @headers.last
|
||||
|
||||
if latest_section.nil? || latest_section.depth >= depth
|
||||
|
|
|
@ -14,7 +14,7 @@ class UserSettingsDecorator
|
|||
|
||||
private
|
||||
|
||||
def process_update
|
||||
def process_update # rubocop:disable Metrics/AbcSize
|
||||
user.settings['notification_emails'] = merged_notification_emails if change?('notification_emails')
|
||||
user.settings['interactions'] = merged_interactions if change?('interactions')
|
||||
user.settings['default_privacy'] = default_privacy_preference if change?('setting_default_privacy')
|
||||
|
|
|
@ -19,7 +19,7 @@ class ValidationErrorFormatter
|
|||
messages = errors.messages[attribute_name]
|
||||
|
||||
h[@aliases[attribute_name] || attribute_name] = attribute_errors.map.with_index do |error, index|
|
||||
{ error: 'ERR_' + error[:error].to_s.upcase, description: messages[index] }
|
||||
{ error: "ERR_#{error[:error].to_s.upcase}", description: messages[index] }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ class Webfinger
|
|||
end
|
||||
|
||||
def standard_url
|
||||
if @domain.end_with? ".onion"
|
||||
if @domain.end_with? '.onion'
|
||||
"http://#{@domain}/.well-known/webfinger?resource=#{@uri}"
|
||||
else
|
||||
"https://#{@domain}/.well-known/webfinger?resource=#{@uri}"
|
||||
|
@ -107,7 +107,7 @@ class Webfinger
|
|||
end
|
||||
|
||||
def host_meta_url
|
||||
if @domain.end_with? ".onion"
|
||||
if @domain.end_with? '.onion'
|
||||
"http://#{@domain}/.well-known/host-meta"
|
||||
else
|
||||
"https://#{@domain}/.well-known/host-meta"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue