Skip to content

Commit 020cd90

Browse files
committed
Rubocop safe corrections
1 parent e699f5a commit 020cd90

File tree

5 files changed

+8
-38
lines changed

5 files changed

+8
-38
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +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: 1
10-
# This cop supports safe autocorrection (--autocorrect).
11-
# Configuration parameters: Severity, Include.
12-
# Include: **/*.gemspec
13-
Gemspec/RequireMFA:
14-
Exclude:
15-
- 'ruby-pwsh.gemspec'
169

1710
# Offense count: 1
1811
# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches, IgnoreDuplicateElseBranch.
@@ -32,19 +25,6 @@ Lint/IncompatibleIoSelectWithFiberScheduler:
3225
Exclude:
3326
- 'lib/pwsh.rb'
3427

35-
# Offense count: 2
36-
# This cop supports safe autocorrection (--autocorrect).
37-
Lint/RedundantCopDisableDirective:
38-
Exclude:
39-
- 'lib/puppet/provider/dsc_base_provider/dsc_base_provider.rb'
40-
41-
# Offense count: 1
42-
# This cop supports safe autocorrection (--autocorrect).
43-
# Configuration parameters: EnforcedStyle.
44-
# SupportedStyles: strict, consistent
45-
Lint/SymbolConversion:
46-
Exclude:
47-
- 'lib/puppet/provider/dsc_base_provider/dsc_base_provider.rb'
4828

4929
# Offense count: 16
5030
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
@@ -191,11 +171,6 @@ RSpec/SubjectStub:
191171
Exclude:
192172
- 'spec/unit/puppet/provider/dsc_base_provider/dsc_base_provider_spec.rb'
193173

194-
# Offense count: 1
195-
# This cop supports safe autocorrection (--autocorrect).
196-
Style/CombinableDefined:
197-
Exclude:
198-
- 'lib/pwsh.rb'
199174

200175
# Offense count: 1
201176
# Configuration parameters: AllowedConstants.
@@ -226,11 +201,6 @@ Style/MapIntoArray:
226201
Exclude:
227202
- 'lib/puppet/provider/dsc_base_provider/dsc_base_provider.rb'
228203

229-
# Offense count: 1
230-
# This cop supports safe autocorrection (--autocorrect).
231-
Style/RedundantFreeze:
232-
Exclude:
233-
- 'lib/puppet/provider/dsc_base_provider/dsc_base_provider.rb'
234204

235205
# Offense count: 1
236206
# This cop supports safe autocorrection (--autocorrect).

Gemfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ def location_for(place_or_version, fake_version = nil)
1414
end
1515

1616
group :development do
17-
gem "json", '= 2.5.1', require: false if Gem::Requirement.create(['>= 3.0.0', '< 3.0.5']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
1817
gem "json", '= 2.6.1', require: false if Gem::Requirement.create(['>= 3.1.0', '< 3.1.3']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
1918
gem "json", '= 2.6.3', require: false if Gem::Requirement.create(['>= 3.2.0', '< 4.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
2019
gem "deep_merge", '~> 1.0', require: false

lib/puppet/provider/dsc_base_provider/dsc_base_provider.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -384,8 +384,8 @@ def invoke_get_method(context, name_hash) # rubocop:disable Metrics/AbcSize
384384
# Canonicalize the results to match the type definition representation;
385385
# failure to do so will prevent the resource_api from comparing the result
386386
# to the should hash retrieved from the resource definition in the manifest.
387-
data.keys.each do |key| # rubocop:disable Style/HashEachMethods
388-
type_key = "dsc_#{key.downcase}".to_sym
387+
data.keys.each do |key|
388+
type_key = :"dsc_#{key.downcase}"
389389
data[type_key] = data.delete(key)
390390

391391
# Special handling for CIM Instances
@@ -598,7 +598,7 @@ def logon_failed_already?(credential_hash)
598598
# @param enumerable [Enumerable] a string, array, hash, or other object to attempt to recursively downcase
599599
def downcase_hash_keys!(enumerable)
600600
if enumerable.is_a?(Hash)
601-
enumerable.keys.each do |key| # rubocop:disable Style/HashEachMethods
601+
enumerable.keys.each do |key|
602602
name = key.dup.downcase
603603
enumerable[name] = enumerable.delete(key)
604604
downcase_hash_keys!(enumerable[name]) if enumerable[name].is_a?(Enumerable)
@@ -1063,7 +1063,7 @@ def escape_quotes(text)
10631063
# With multiple methods which need to discover secrets it is necessary to keep a single regex
10641064
# which can discover them. This will lazily match everything in a single-quoted string which
10651065
# ends with the secret postfix id and mark the actual contents of the string as the secret.
1066-
SECRET_DATA_REGEX = /'(?<secret>[^']+)+?#{Regexp.quote(SECRET_POSTFIX)}'/.freeze
1066+
SECRET_DATA_REGEX = /'(?<secret>[^']+)+?#{Regexp.quote(SECRET_POSTFIX)}'/
10671067

10681068
# Strings containing sensitive data have a secrets postfix. These strings cannot be passed
10691069
# directly either to debug streams or to PowerShell and must be handled; this method contains

lib/pwsh.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ def self.instance(cmd, args, options = {})
6868
#
6969
# @return [Bool] true if enabled
7070
def self.win32console_enabled?
71-
@win32console_enabled ||= defined?(Win32) &&
72-
defined?(Win32::Console) &&
73-
Win32::Console.instance_of?(Class)
71+
@win32console_enabled ||=
72+
defined?(Win32::Console) &&
73+
Win32::Console.instance_of?(Class)
7474
end
7575

7676
# TODO: This thing isn't called anywhere and the variable it sets is never referenced...

ruby-pwsh.gemspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,5 @@ Gem::Specification.new do |spec|
3333
spec.require_paths = ['lib']
3434

3535
spec.required_ruby_version = Gem::Requirement.new('>= 3.1.0')
36+
spec.metadata['rubygems_mfa_required'] = 'true'
3637
end

0 commit comments

Comments
 (0)