Skip to content

Commit 64feb9b

Browse files
committed
Correct Layout/HeredocIndentation
1 parent 3e4a916 commit 64feb9b

File tree

2 files changed

+84
-90
lines changed

2 files changed

+84
-90
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@
66
# Note that changes in the inspected code, or installation of new
77
# versions of RuboCop, may require this file to be generated again.
88

9-
# Offense count: 7
10-
# This cop supports safe autocorrection (--autocorrect).
11-
Layout/HeredocIndentation:
12-
Exclude:
13-
- 'spec/unit/puppet_x/dsc_lite/powershell_hash_formatter_spec.rb'
14-
159
# Offense count: 3
1610
# This cop supports safe autocorrection (--autocorrect).
1711
Lint/AmbiguousOperatorPrecedence:

spec/unit/puppet_x/dsc_lite/powershell_hash_formatter_spec.rb

Lines changed: 84 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,31 @@
1414
describe 'formatting ruby hash to powershell hash string' do
1515
describe 'when given correct hash' do
1616
it 'outputs correct syntax with simple example' do
17-
expected = <<-HERE
18-
@{
19-
'ensure' = 'present';
20-
'name' = 'Web-WebServer'
21-
}
17+
expected = <<~HERE
18+
@{
19+
'ensure' = 'present';
20+
'name' = 'Web-WebServer'
21+
}
2222
HERE
2323
result = formatter.format('ensure' => 'present',
2424
'name' => 'Web-WebServer')
2525
expect(result).to eq expected.strip
2626
end
2727

2828
it 'outputs correct syntax with single CimInstance for a CimInstance[] type' do
29-
expected = <<-HERE
30-
@{
31-
'ensure' = 'Present';
32-
'name' = 'foo';
33-
'state' = 'Started';
34-
'physicalpath' = 'c:/inetpub/wwwroot';
35-
'bindinginfo' = [CimInstance[]]@(
36-
(New-CimInstance -ClassName 'MSFT_xWebBindingInformation' -ClientOnly -Property @{
37-
'protocol' = 'HTTP';
38-
'port' = 80
39-
})
40-
)
41-
}
29+
expected = <<~HERE
30+
@{
31+
'ensure' = 'Present';
32+
'name' = 'foo';
33+
'state' = 'Started';
34+
'physicalpath' = 'c:/inetpub/wwwroot';
35+
'bindinginfo' = [CimInstance[]]@(
36+
(New-CimInstance -ClassName 'MSFT_xWebBindingInformation' -ClientOnly -Property @{
37+
'protocol' = 'HTTP';
38+
'port' = 80
39+
})
40+
)
41+
}
4242
HERE
4343

4444
result = formatter.format('ensure' => 'Present',
@@ -57,19 +57,19 @@
5757
end
5858

5959
it 'outputs correct syntax with single CimInstance for a CimInstance type' do
60-
expected = <<-HERE
61-
@{
62-
'ensure' = 'Present';
63-
'name' = 'foo';
64-
'state' = 'Started';
65-
'physicalpath' = 'c:/inetpub/wwwroot';
66-
'authenticationinfo' = [CimInstance](New-CimInstance -ClassName 'MSFT_xWebAuthenticationInformation' -ClientOnly -Property @{
67-
'anonymous' = $true;
68-
'basic' = $false;
69-
'windows' = $true;
70-
'digest' = $false
71-
})
72-
}
60+
expected = <<~HERE
61+
@{
62+
'ensure' = 'Present';
63+
'name' = 'foo';
64+
'state' = 'Started';
65+
'physicalpath' = 'c:/inetpub/wwwroot';
66+
'authenticationinfo' = [CimInstance](New-CimInstance -ClassName 'MSFT_xWebAuthenticationInformation' -ClientOnly -Property @{
67+
'anonymous' = $true;
68+
'basic' = $false;
69+
'windows' = $true;
70+
'digest' = $false
71+
})
72+
}
7373
HERE
7474

7575
result = formatter.format('ensure' => 'Present',
@@ -90,26 +90,26 @@
9090
end
9191

9292
it 'outputs correct syntax with array CimInstance' do
93-
expected = <<-HERE
94-
@{
95-
'ensure' = 'Present';
96-
'name' = 'foo';
97-
'state' = 'Started';
98-
'physicalpath' = 'c:/inetpub/wwwroot';
99-
'bindinginfo' = [CimInstance[]]@(
100-
(New-CimInstance -ClassName 'MSFT_xWebBindingInformation' -ClientOnly -Property @{
101-
'protocol' = 'HTTP';
102-
'port' = 80
103-
}),
104-
(New-CimInstance -ClassName 'MSFT_xWebBindingInformation' -ClientOnly -Property @{
105-
'protocol' = 'HTTPS';
106-
'port' = 443;
107-
'certificatethumbprint' = '5438DC0CB31B1C91B8945C7D91B3338F9C08BEFA';
108-
'certificatestorename' = 'My';
109-
'ipaddress' = '*'
110-
})
111-
)
112-
}
93+
expected = <<~HERE
94+
@{
95+
'ensure' = 'Present';
96+
'name' = 'foo';
97+
'state' = 'Started';
98+
'physicalpath' = 'c:/inetpub/wwwroot';
99+
'bindinginfo' = [CimInstance[]]@(
100+
(New-CimInstance -ClassName 'MSFT_xWebBindingInformation' -ClientOnly -Property @{
101+
'protocol' = 'HTTP';
102+
'port' = 80
103+
}),
104+
(New-CimInstance -ClassName 'MSFT_xWebBindingInformation' -ClientOnly -Property @{
105+
'protocol' = 'HTTPS';
106+
'port' = 443;
107+
'certificatethumbprint' = '5438DC0CB31B1C91B8945C7D91B3338F9C08BEFA';
108+
'certificatestorename' = 'My';
109+
'ipaddress' = '*'
110+
})
111+
)
112+
}
113113
HERE
114114

115115
result = formatter.format('ensure' => 'Present',
@@ -137,18 +137,18 @@
137137
end
138138

139139
it 'outputs correct syntax with a PSCredential' do
140-
expected = <<-HERE
141-
@{
142-
'username' = 'jane-doe';
143-
'description' = 'Jane Doe user';
144-
'ensure' = 'present';
145-
'password' = ([PSCustomObject]@{
146-
'user' = 'jane-doe';
147-
'password' = 'jane-password'
148-
} | new-pscredential);
149-
'passwordneverexpires' = $false;
150-
'disabled' = $true
151-
}
140+
expected = <<~HERE
141+
@{
142+
'username' = 'jane-doe';
143+
'description' = 'Jane Doe user';
144+
'ensure' = 'present';
145+
'password' = ([PSCustomObject]@{
146+
'user' = 'jane-doe';
147+
'password' = 'jane-password'
148+
} | new-pscredential);
149+
'passwordneverexpires' = $false;
150+
'disabled' = $true
151+
}
152152
HERE
153153
result = formatter.format('username' => 'jane-doe',
154154
'description' => 'Jane Doe user',
@@ -166,15 +166,15 @@
166166
end
167167

168168
it 'outputs correct syntax with MSFT_KeyValuePair' do
169-
expected = <<-HERE
170-
@{
171-
'destinationPath' = 'c:\fileName.jpg';
172-
'uri' = 'http://www.contoso.com/image.jpg';
173-
'userAgent' = '[Microsoft.PowerShell.Commands.PSUserAgent]::InternetExplorer';
174-
'headers' = @{
175-
'Accept-Language' = 'en-US'
176-
}
177-
}
169+
expected = <<~HERE
170+
@{
171+
'destinationPath' = 'c:\fileName.jpg';
172+
'uri' = 'http://www.contoso.com/image.jpg';
173+
'userAgent' = '[Microsoft.PowerShell.Commands.PSUserAgent]::InternetExplorer';
174+
'headers' = @{
175+
'Accept-Language' = 'en-US'
176+
}
177+
}
178178
HERE
179179
result = formatter.format('destinationPath' => "c:\fileName.jpg",
180180
'uri' => 'http://www.contoso.com/image.jpg',
@@ -186,18 +186,18 @@
186186
end
187187

188188
it 'outputs correct syntax with Sensitive MSFT_Credential' do
189-
expected = <<-HERE
190-
@{
191-
'username' = 'jane-doe';
192-
'description' = 'Jane Doe user';
193-
'ensure' = 'present';
194-
'password' = ([PSCustomObject]@{
195-
'user' = 'jane-doe';
196-
'password' = 'password' # PuppetSensitive
197-
} | new-pscredential);
198-
'passwordneverexpires' = $false;
199-
'disabled' = $true
200-
}
189+
expected = <<~HERE
190+
@{
191+
'username' = 'jane-doe';
192+
'description' = 'Jane Doe user';
193+
'ensure' = 'present';
194+
'password' = ([PSCustomObject]@{
195+
'user' = 'jane-doe';
196+
'password' = 'password' # PuppetSensitive
197+
} | new-pscredential);
198+
'passwordneverexpires' = $false;
199+
'disabled' = $true
200+
}
201201
HERE
202202
sensitive_pass = Puppet::Pops::Types::PSensitiveType::Sensitive.new('password')
203203
result = formatter.format('username' => 'jane-doe',

0 commit comments

Comments
 (0)