Update Rubocop to 0.60

This commit is contained in:
Régis Hanol 2018-12-04 10:48:16 +01:00
parent 72bd388ff7
commit 3c9c95ac83
23 changed files with 141 additions and 126 deletions

View File

@ -270,7 +270,7 @@ GEM
redis
ruby-openid
parallel (1.12.1)
parser (2.5.1.0)
parser (2.5.3.0)
ast (~> 2.4.0)
pg (1.1.3)
powerpack (0.1.2)
@ -357,17 +357,17 @@ GEM
rspec-support (~> 3.7.0)
rspec-support (3.7.1)
rtlit (0.0.5)
rubocop (0.57.2)
rubocop (0.60.0)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.5)
parser (>= 2.5, != 2.5.1.1)
powerpack (~> 0.1)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
unicode-display_width (~> 1.4.0)
ruby-openid (2.7.0)
ruby-prof (0.17.0)
ruby-progressbar (1.9.0)
ruby-progressbar (1.10.0)
ruby-readability (0.7.0)
guess_html_encoding (>= 0.0.4)
nokogiri (>= 1.6.0)

View File

@ -4,6 +4,8 @@ require_dependency 'distributed_cache'
class ColorScheme < ActiveRecord::Base
# rubocop:disable Layout/AlignHash
CUSTOM_SCHEMES = {
'Dark': {
"primary" => 'dddddd',
@ -97,8 +99,11 @@ class ColorScheme < ActiveRecord::Base
}
}
# rubocop:enable Layout/AlignHash
def self.base_color_scheme_colors
base_with_hash = {}
base_colors.each do |name, color|
base_with_hash[name] = "#{color}"
end
@ -110,6 +115,7 @@ class ColorScheme < ActiveRecord::Base
CUSTOM_SCHEMES.each do |k, v|
list.push(id: k.to_s, colors: v)
end
list
end
@ -208,6 +214,7 @@ class ColorScheme < ActiveRecord::Base
def colors_by_name
@colors_by_name ||= self.colors.inject({}) { |sum, c| sum[c.name] = c; sum; }
end
def clear_colors_cache
@colors_by_name = nil
end

View File

@ -118,7 +118,6 @@ class TagUser < ActiveRecord::Base
end
def self.auto_track(opts)
builder = DB.build <<~SQL
UPDATE topic_users
SET notification_level = :tracking, notifications_reason_id = :auto_track_tag

View File

@ -5,7 +5,8 @@ if (Rails.env.development? || Rails.env.test?)
task :set_annotation_options do
# You can override any of these by setting an environment variable of the
# same name.
Annotate.set_defaults('position_in_routes' => "before",
Annotate.set_defaults(
'position_in_routes' => "before",
'position_in_class' => "after",
'position_in_test' => "before",
'position_in_fixture' => "before",
@ -28,7 +29,8 @@ if (Rails.env.development? || Rails.env.test?)
'format_markdown' => "false",
'sort' => "false",
'force' => "false",
'trace' => "false")
'trace' => "false"
)
end
end

View File

@ -14,6 +14,8 @@ class BulkImport::Base
NOW ||= "now()".freeze
PRIVATE_OFFSET ||= 2**30
# rubocop:disable Layout/AlignHash
CHARSET_MAP = {
"armscii8" => nil,
"ascii" => Encoding::US_ASCII,
@ -53,6 +55,8 @@ class BulkImport::Base
"utf8" => Encoding::UTF_8,
}
# rubocop:enable Layout/AlignHash
def initialize
charset = ENV["DB_CHARSET"] || "utf8"
db = ActiveRecord::Base.connection_config

View File

@ -151,13 +151,15 @@ class ImportScripts::Nabble < ImportScripts::Base
raw = process_content(raw)
raw = process_attachments(raw, t['node_id'])
{ id: t['node_id'],
{
id: t['node_id'],
title: t['subject'],
user_id: user_id_from_imported_user_id(t["owner_id"]) || Discourse::SYSTEM_USER_ID,
created_at: Time.zone.at(@td.decode(t["when_created"])),
category: CATEGORY_ID,
raw: raw,
cook_method: Post.cook_methods[:regular] }
cook_method: Post.cook_methods[:regular]
}
end
end
end

View File

@ -23,7 +23,8 @@ $delivery_options = {
password: @DISCOURSE_SMTP_PASSWORD || nil,
address: DISCOURSE_SMTP_ADDRESS,
port: @DISCOURSE_SMTP_PORT || nil,
openssl_verify_mode: @DISCOURSE_SMTP_OPENSSL_VERIFY_MODE || nil }
openssl_verify_mode: @DISCOURSE_SMTP_OPENSSL_VERIFY_MODE || nil
}
class EmailTestMailer < ActionMailer::Base
def email_test(mailfrom, mailto)