Add and apply FileRead and FileWrite rubocop rules
They were added in Rubocop 1.24.0. Even if we were already applying FileRead everywhere, this is something we've manually fixed in the past. Another reason to add it is that these rules are deeply related.
This commit is contained in:
@@ -485,6 +485,12 @@ Style/ClassVars:
|
||||
Style/CollectionMethods:
|
||||
Enabled: true
|
||||
|
||||
Style/FileRead:
|
||||
Enabled: true
|
||||
|
||||
Style/FileWrite:
|
||||
Enabled: true
|
||||
|
||||
Style/HashConversion:
|
||||
Enabled: true
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ module JsonExporter
|
||||
def to_json_file(filename)
|
||||
data = []
|
||||
model.find_each { |record| data << json_values(record) }
|
||||
File.open(filename, "w") { |file| file.write(data.to_json) }
|
||||
File.write(filename, data.to_json)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -216,9 +216,9 @@ describe "Machine learning" do
|
||||
kind: "comments_summary",
|
||||
updated_at: 2.minutes.from_now)
|
||||
comments_file = MachineLearning::DATA_FOLDER.join(MachineLearning.comments_filename)
|
||||
File.open(comments_file, "w") { |file| file.write([].to_json) }
|
||||
File.write(comments_file, [].to_json)
|
||||
proposals_comments_summary_file = MachineLearning::DATA_FOLDER.join(MachineLearning.proposals_comments_summary_filename)
|
||||
File.open(proposals_comments_summary_file, "w") { |file| file.write([].to_json) }
|
||||
File.write(proposals_comments_summary_file, [].to_json)
|
||||
end
|
||||
|
||||
visit admin_machine_learning_path
|
||||
|
||||
Reference in New Issue
Block a user