Skip to content

Commit 739cfc6

Browse files
committed
Suppress Lint/NonAtomicFileOperation offenses
This commit suppresss the following `Lint/NonAtomicFileOperation` offenses. ```console Offenses: 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) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 257 files inspected, 2 offenses detected, 2 offenses autocorrectable RuboCop failed! ```
1 parent 0b7d5f3 commit 739cfc6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

spec/support/file_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def create_file(file_path, content)
77
file_path = File.expand_path(file_path)
88

99
dir_path = File.dirname(file_path)
10-
FileUtils.makedirs dir_path unless File.exist?(dir_path)
10+
FileUtils.mkdir_p dir_path
1111

1212
File.open(file_path, 'w') do |file|
1313
case content

tasks/changelog.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def initialize(type:, body: last_commit_title, ref_type: nil, ref_id: nil, user:
3030
end
3131

3232
def write
33-
Dir.mkdir(ENTRIES_PATH) unless Dir.exist?(ENTRIES_PATH)
33+
FileUtils.mkdir_p(ENTRIES_PATH)
3434
File.write(path, content)
3535
path
3636
end

0 commit comments

Comments
 (0)