Add and apply Lint/NonAtomicFileOperation rule

This rule was added in Rubocop 1.31.0; it follows the principles
mentioned in the Ruby Style Guide [1].

https://rubystyle.guide/#atomic-file-operations
This commit is contained in:
Javi Martín
2022-08-25 23:02:33 +02:00
parent 4a851c0d82
commit 0d4a032f52
2 changed files with 4 additions and 1 deletions

View File

@@ -179,6 +179,9 @@ Lint/EmptyFile:
Lint/LiteralAsCondition:
Enabled: true
Lint/NonAtomicFileOperation:
Enabled: true
Lint/ParenthesesAsGroupedExpression:
Enabled: true

View File

@@ -4,7 +4,7 @@ describe "rake sitemap:create", type: :system do
let(:file) { Rails.root.join("public", "sitemap.xml") }
before do
File.delete(file) if File.exist?(file)
FileUtils.rm_f(file)
Rake::Task["sitemap:create"].reenable
end