From 25fe8fb3229f77c07a11d62796f51d85d7b6c9f2 Mon Sep 17 00:00:00 2001 From: Phil Pirozhkov Date: Tue, 28 Jun 2022 00:15:47 +0300 Subject: [PATCH] Appease RuboCop spec/support/file_helper.rb:10:33: W: [Correctable] Lint/NonAtomicFileOperation: Remove unnecessary existence checks File.exist?. FileUtils.makedirs dir_path unless File.exist?(dir_path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ tasks/changelog.rb:33:31: W: [Correctable] Lint/NonAtomicFileOperation: Remove unnecessary existence checks Dir.exist?. Dir.mkdir(ENTRIES_PATH) unless Dir.exist?(ENTRIES_PATH) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --- spec/support/file_helper.rb | 2 +- tasks/changelog.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/support/file_helper.rb b/spec/support/file_helper.rb index 1e859eb0fd..251788f460 100644 --- a/spec/support/file_helper.rb +++ b/spec/support/file_helper.rb @@ -7,7 +7,7 @@ def create_file(file_path, content) file_path = File.expand_path(file_path) dir_path = File.dirname(file_path) - FileUtils.makedirs dir_path unless File.exist?(dir_path) + FileUtils.makedirs dir_path File.open(file_path, 'w') do |file| case content diff --git a/tasks/changelog.rb b/tasks/changelog.rb index 3e7b336b41..5740cdb230 100644 --- a/tasks/changelog.rb +++ b/tasks/changelog.rb @@ -30,7 +30,7 @@ def initialize(type:, body: last_commit_title, ref_type: nil, ref_id: nil, user: end def write - Dir.mkdir(ENTRIES_PATH) unless Dir.exist?(ENTRIES_PATH) + Dir.mkdir(ENTRIES_PATH) File.write(path, content) path end