mirror of
https://github.com/discourse/discourse.git
synced 2025-09-04 08:47:37 +08:00
DEV: Fix rubocop issues (#14715)
This commit is contained in:
parent
6aa6275f3f
commit
69f0f48dc0
27 changed files with 65 additions and 69 deletions
|
@ -297,7 +297,7 @@ begin
|
|||
run("RAILS_ENV=profile bundle exec rake assets:clean")
|
||||
|
||||
def get_mem(pid)
|
||||
YAML.load `ruby script/memstats.rb #{pid} --yaml`
|
||||
YAML.safe_load `ruby script/memstats.rb #{pid} --yaml`
|
||||
end
|
||||
|
||||
mem = get_mem(pid)
|
||||
|
|
2
script/benchmarks/cache/bench.rb
vendored
2
script/benchmarks/cache/bench.rb
vendored
|
@ -46,7 +46,7 @@ Benchmark.ips do |x|
|
|||
|
||||
x.report("redis get string marshal") do |times|
|
||||
while times > 0
|
||||
Marshal.load(Discourse.redis.get("test_keym"))
|
||||
Marshal.load(Discourse.redis.get("test_keym")) # rubocop:disable Security/MarshalLoad
|
||||
times -= 1
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,7 +10,7 @@ class ImportScripts::JForum < ImportScripts::Base
|
|||
def initialize
|
||||
super
|
||||
|
||||
@settings = YAML.load(File.read(ARGV.first), symbolize_names: true)
|
||||
@settings = YAML.safe_load(File.read(ARGV.first), symbolize_names: true)
|
||||
|
||||
@database_client = Mysql2::Client.new(
|
||||
host: @settings[:database][:host],
|
||||
|
|
|
@ -48,7 +48,7 @@ module ImportScripts::Mbox
|
|||
if File.exist?(metadata_file)
|
||||
# workaround for YML files that contain classname in file header
|
||||
yaml = File.read(metadata_file).sub(/^--- !.*$/, '---')
|
||||
metadata = YAML.load(yaml)
|
||||
metadata = YAML.safe_load(yaml)
|
||||
else
|
||||
metadata = {}
|
||||
end
|
||||
|
|
|
@ -180,7 +180,7 @@ class ImportScripts::NodeBB < ImportScripts::Base
|
|||
if is_external
|
||||
# download external image
|
||||
begin
|
||||
string_io = open(picture, read_timeout: 5)
|
||||
string_io = uri.open(read_timeout: 5)
|
||||
rescue Net::ReadTimeout
|
||||
puts "timeout downloading avatar for user #{imported_user.id}"
|
||||
return nil
|
||||
|
@ -246,7 +246,7 @@ class ImportScripts::NodeBB < ImportScripts::Base
|
|||
|
||||
if is_external
|
||||
begin
|
||||
string_io = open(picture, read_timeout: 5)
|
||||
string_io = uri.open(read_timeout: 5)
|
||||
rescue Net::ReadTimeout
|
||||
return nil
|
||||
end
|
||||
|
|
|
@ -558,7 +558,7 @@ class ImportScripts::Smf2 < ImportScripts::Base
|
|||
|
||||
def read_smf_settings
|
||||
settings = File.join(self.smfroot, 'Settings.php')
|
||||
IO.readlines(settings).each do |line|
|
||||
File.readlines(settings).each do |line|
|
||||
next unless m = /\$([a-z_]+)\s*=\s*['"](.+?)['"]\s*;\s*((#|\/\/).*)?$/.match(line)
|
||||
case m[1]
|
||||
when 'db_server' then self.host ||= m[2]
|
||||
|
|
|
@ -333,7 +333,7 @@ class ImportScripts::ZendeskApi < ImportScripts::Base
|
|||
attempts = 0
|
||||
|
||||
begin
|
||||
open("#{$1}") do |image|
|
||||
URI.parse(image_url).open do |image|
|
||||
# IMAGE_DOWNLOAD_PATH is whatever image, it will be replaced with the downloaded image
|
||||
File.open(IMAGE_DOWNLOAD_PATH, "wb") do |file|
|
||||
file.write(image.read)
|
||||
|
|
|
@ -131,7 +131,7 @@ def format_number(n)
|
|||
end
|
||||
|
||||
def get_commandline(pid)
|
||||
commandline = IO.read("/proc/#{pid}/cmdline").split("\0")
|
||||
commandline = File.read("/proc/#{pid}/cmdline").split("\0")
|
||||
if commandline.first =~ /java$/ then
|
||||
loop { break if commandline.shift == "-jar" }
|
||||
return "[java] #{commandline.shift}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue