Skip to content

Commit ee1f3e4

Browse files
committed
new todo and some unsafe corrections
1 parent a489d72 commit ee1f3e4

File tree

3 files changed

+36
-14
lines changed

3 files changed

+36
-14
lines changed

.rubocop_todo.yml

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2024-01-30 16:36:55 UTC using RuboCop version 1.50.2.
3+
# on 2025-04-09 12:37:11 UTC using RuboCop version 1.70.0.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
@@ -15,7 +15,7 @@ Gemspec/RequireMFA:
1515
- 'ruby-pwsh.gemspec'
1616

1717
# Offense count: 1
18-
# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches.
18+
# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches, IgnoreDuplicateElseBranch.
1919
Lint/DuplicateBranch:
2020
Exclude:
2121
- 'lib/puppet/provider/dsc_base_provider/dsc_base_provider.rb'
@@ -37,23 +37,23 @@ Lint/IncompatibleIoSelectWithFiberScheduler:
3737
Metrics/AbcSize:
3838
Max: 83
3939

40-
# Offense count: 2
40+
# Offense count: 1
4141
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
4242
# AllowedMethods: refine
4343
Metrics/BlockLength:
44-
Max: 35
44+
Max: 28
4545

46-
# Offense count: 2
46+
# Offense count: 1
4747
# Configuration parameters: CountComments, CountAsOne.
4848
Metrics/ClassLength:
49-
Max: 553
49+
Max: 296
5050

5151
# Offense count: 12
5252
# Configuration parameters: AllowedMethods, AllowedPatterns.
5353
Metrics/CyclomaticComplexity:
5454
Max: 24
5555

56-
# Offense count: 23
56+
# Offense count: 22
5757
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
5858
Metrics/MethodLength:
5959
Max: 42
@@ -69,6 +69,7 @@ Metrics/PerceivedComplexity:
6969
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
7070
Naming/FileName:
7171
Exclude:
72+
- 'Rakefile.rb'
7273
- 'lib/ruby-pwsh.rb'
7374

7475
# Offense count: 1
@@ -118,12 +119,12 @@ RSpec/DescribeClass:
118119
- 'spec/acceptance/dsc/complex.rb'
119120
- 'spec/unit/pwsh_spec.rb'
120121

121-
# Offense count: 32
122+
# Offense count: 38
122123
# Configuration parameters: CountAsOne.
123124
RSpec/ExampleLength:
124125
Max: 70
125126

126-
# Offense count: 105
127+
# Offense count: 151
127128
# Configuration parameters: .
128129
# SupportedStyles: have_received, receive
129130
RSpec/MessageSpies:
@@ -134,7 +135,7 @@ RSpec/MultipleDescribes:
134135
Exclude:
135136
- 'spec/unit/pwsh_spec.rb'
136137

137-
# Offense count: 151
138+
# Offense count: 157
138139
RSpec/MultipleExpectations:
139140
Max: 15
140141

@@ -156,14 +157,14 @@ RSpec/NoExpectationExample:
156157
- 'spec/unit/pwsh/windows_powershell_spec.rb'
157158
- 'spec/unit/pwsh_spec.rb'
158159

159-
# Offense count: 56
160+
# Offense count: 86
160161
RSpec/StubbedMock:
161162
Exclude:
162163
- 'spec/unit/puppet/provider/dsc_base_provider/dsc_base_provider_spec.rb'
163164
- 'spec/unit/pwsh/util_spec.rb'
164165
- 'spec/unit/pwsh/windows_powershell_spec.rb'
165166

166-
# Offense count: 65
167+
# Offense count: 71
167168
RSpec/SubjectStub:
168169
Exclude:
169170
- 'spec/unit/puppet/provider/dsc_base_provider/dsc_base_provider_spec.rb'
@@ -175,3 +176,24 @@ Style/Documentation:
175176
- 'spec/**/*'
176177
- 'test/**/*'
177178
- 'lib/puppet/provider/dsc_base_provider/dsc_base_provider.rb'
179+
180+
# Offense count: 3
181+
# This cop supports unsafe autocorrection (--autocorrect-all).
182+
# Configuration parameters: AllowedReceivers.
183+
# AllowedReceivers: Thread.current
184+
Style/HashEachMethods:
185+
Exclude:
186+
- 'lib/puppet/provider/dsc_base_provider/dsc_base_provider.rb'
187+
188+
# Offense count: 2
189+
# This cop supports unsafe autocorrection (--autocorrect-all).
190+
Style/HashExcept:
191+
Exclude:
192+
- 'lib/puppet/provider/dsc_base_provider/dsc_base_provider.rb'
193+
- 'spec/unit/puppet/provider/dsc_base_provider/dsc_base_provider_spec.rb'
194+
195+
# Offense count: 2
196+
# This cop supports unsafe autocorrection (--autocorrect-all).
197+
Style/MapIntoArray:
198+
Exclude:
199+
- 'lib/puppet/provider/dsc_base_provider/dsc_base_provider.rb'

lib/puppet/provider/dsc_base_provider/dsc_base_provider.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ def retry_invoke_dsc_resource(context, max_retry_count, retry_wait_interval_secs
353353
# @return [Boolean, Void] returns true/false if the resource is/isn't in the desired state and
354354
# the validation mode is set to resource, otherwise nil.
355355
def insync?(context, name, _property_name, _is_hash, should_hash)
356-
return nil if should_hash[:validation_mode] != 'resource'
356+
return false if should_hash[:validation_mode] != 'resource'
357357

358358
prior_result = fetch_cached_hashes(@cached_test_results, [name])
359359
prior_result.empty? ? invoke_test_method(context, name, should_hash) : prior_result.first[:in_desired_state]

spec/unit/puppet/provider/dsc_base_provider/dsc_base_provider_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@
416416
it 'does not call invoke_test_method and returns nil' do
417417
expect(provider).not_to receive(:fetch_cached_hashes)
418418
expect(provider).not_to receive(:invoke_test_method)
419-
expect(provider.send(:insync?, context, name, attribute_name, is_hash, should_hash_validate_by_property)).to be_nil
419+
expect(provider.send(:insync?, context, name, attribute_name, is_hash, should_hash_validate_by_property)).to be false
420420
end
421421
end
422422
end

0 commit comments

Comments
 (0)