Skip to content

Commit 3296b7a

Browse files
committed
rubocop: autofix
1 parent c4a0d9f commit 3296b7a

9 files changed

Lines changed: 31 additions & 9 deletions

File tree

.rubocop.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
---
2+
inherit_from: .rubocop_todo.yml
3+
24
# Managed by modulesync - DO NOT EDIT
35
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
46

.rubocop_todo.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# This configuration was generated by
2+
# `rubocop --auto-gen-config`
3+
# on 2023-08-17 21:26:09 UTC using RuboCop version 1.50.2.
4+
# The point is for the user to remove these configuration records
5+
# one by one as the offenses are removed from the code base.
6+
# Note that changes in the inspected code, or installation of new
7+
# versions of RuboCop, may require this file to be generated again.
8+
9+
# Offense count: 2
10+
# This cop supports unsafe autocorrection (--autocorrect-all).
11+
Lint/NonAtomicFileOperation:
12+
Exclude:
13+
- 'lib/puppet/provider/archive/ruby.rb'
14+
15+
# Offense count: 1
16+
# This cop supports unsafe autocorrection (--autocorrect-all).
17+
# Configuration parameters: AllowComments.
18+
Style/RedundantInitialize:
19+
Exclude:
20+
- 'lib/puppet_x/bodeco/util.rb'

lib/puppet/type/archive.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def should_to_s(value)
208208
desc 'optional header(s) to pass.'
209209

210210
validate do |val|
211-
raise ArgumentError, "headers must be an array: #{val}" unless val.is_a?(::Array)
211+
raise ArgumentError, "headers must be an array: #{val}" unless val.is_a?(Array)
212212
end
213213
end
214214

@@ -238,12 +238,12 @@ def should_to_s(value)
238238
desc 'provider download options (affects curl, wget, gs, and only s3 downloads for ruby provider)'
239239

240240
validate do |val|
241-
raise ArgumentError, "download_options should be String or Array: #{val}" unless val.is_a?(::String) || val.is_a?(::Array)
241+
raise ArgumentError, "download_options should be String or Array: #{val}" unless val.is_a?(String) || val.is_a?(Array)
242242
end
243243

244244
munge do |val|
245245
case val
246-
when ::String
246+
when String
247247
[val]
248248
else
249249
val

lib/puppet_x/bodeco/archive.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def win_7zip
7979
Add-Type -AssemblyName System.IO.Compression.FileSystem -erroraction "silentlycontinue"
8080
$zipFile = [System.IO.Compression.ZipFile]::openread(#{@file_path})
8181
foreach ($zipFileEntry in $zipFile.Entries) {
82-
$pwd = (Get-Item -Path ".\" -Verbose).FullName
82+
$pwd = (Get-Item -Path "." -Verbose).FullName
8383
$outputFile = [io.path]::combine($pwd, $zipFileEntry.FullName)
8484
$dir = ([io.fileinfo]$outputFile).DirectoryName
8585

lib/puppet_x/bodeco/util.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def self.puppet_download(url, filepath)
3333
status = load_file_with_any_terminus(url)
3434
raise ArgumentError, "Previous error(s) resulted in Puppet being unable to retrieve information from environment #{Puppet['environment']} source(s) #{url}'\nMost probable cause is file not found." unless status
3535

36-
File.open(filepath, 'wb') { |file| file.write(status.content) }
36+
File.binwrite(filepath, status.content)
3737
end
3838

3939
# @private

spec/functions/archive_go_md5_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
context 'when file doesn\'t exist' do
1818
it 'raises error' do
1919
allow(PuppetX::Bodeco::Util).to receive(:content).with(uri, username: 'user', password: 'pass').and_return(example_md5)
20-
expect(subject).to run.with_params('user', 'pass', 'non-existent-file', url).and_raise_error(RuntimeError, "Could not parse md5 from url https://gocd\.lan/path/file\.md5 response: #{example_md5}")
20+
expect(subject).to run.with_params('user', 'pass', 'non-existent-file', url).and_raise_error(RuntimeError, "Could not parse md5 from url https://gocd.lan/path/file.md5 response: #{example_md5}")
2121
end
2222
end
2323
end

spec/unit/puppet/provider/archive/curl_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
it 'populates temp netrc file with credentials' do
5959
allow(provider).to receive(:delete_netrcfile) # Don't delete the file or we won't be able to examine its contents.
6060
provider.download(name)
61-
nettc_content = File.open(tempfile.path).read
61+
nettc_content = File.read(tempfile.path)
6262
expect(nettc_content).to eq("machine home.lan\nlogin foo\npassword bar\n")
6363
end
6464

spec/unit/puppet/provider/archive/gs_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
before do
4848
resource[:checksum_url] = url if url
49-
allow(PuppetX::Bodeco::Util).to receive(:content).\
49+
allow(PuppetX::Bodeco::Util).to receive(:content). \
5050
with(url, any_args).and_return(remote_hash)
5151
end
5252

spec/unit/puppet/provider/archive/ruby_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
before do
4848
resource[:checksum_url] = url if url
49-
allow(PuppetX::Bodeco::Util).to receive(:content).\
49+
allow(PuppetX::Bodeco::Util).to receive(:content). \
5050
with(url, any_args).and_return(remote_hash)
5151
end
5252

0 commit comments

Comments
 (0)