Skip to content

Commit

Permalink
Suppress Lint/NonAtomicFileOperation offense
Browse files Browse the repository at this point in the history
This commit suppresss the following `Lint/NonAtomicFileOperation` offense.

```console
% bundle exec rubocop
(snip)

Offenses:

tasks/changelog.rb:33:31: W: [Correctable] Lint/NonAtomicFileOperation:
Remove unnecessary existence checks Dir.exist?.
Dir.mkdir(ENTRIES_PATH) unless Dir.exist?(ENTRIES_PATH)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

115 files inspected, 1 offense detected, 1 offense autocorrectable
RuboCop failed!
```
  • Loading branch information
koic committed Jun 27, 2022
1 parent bb804c8 commit 36065b7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tasks/changelog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
FileUtils.mkdir_p(ENTRIES_PATH)
File.write(path, content)
path
end
Expand Down

0 comments on commit 36065b7

Please sign in to comment.