Skip to content

Commit a489d72

Browse files
committed
Rubocop bump and safe corrections
1 parent bccc7cb commit a489d72

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ group :development do
2727
gem "pry", '~> 0.10', require: false
2828
gem "simplecov-console", '~> 0.9', require: false
2929
gem "puppet-debugger", '~> 1.0', require: false
30-
gem "rubocop", '~> 1.50.0', require: false
30+
gem "rubocop", '~> 1.70.0', require: false
3131
gem "rubocop-performance", '1.22.1', require: false
3232
gem "rubocop-rspec", '= 2.19.0', require: false
3333
gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw]

lib/puppet/provider/dsc_base_provider/dsc_base_provider.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ def insync?(context, name, _property_name, _is_hash, should_hash)
368368
# @param context [Object] the Puppet runtime context to operate in and send feedback to
369369
# @param name_hash [Hash] the hash of namevars to be passed as properties to `Invoke-DscResource`
370370
# @return [Hash] returns a hash representing the DSC resource munged to the representation the Puppet Type expects
371-
def invoke_get_method(context, name_hash) # rubocop:disable Metrics/AbcSize
371+
def invoke_get_method(context, name_hash)
372372
context.debug("retrieving #{name_hash.inspect}")
373373

374374
query_props = name_hash.select { |k, v| mandatory_get_attributes(context).include?(k) || (k == :dsc_psdscrunascredential && !v.nil?) }
@@ -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
@@ -557,7 +557,7 @@ def puppetize_name(name)
557557
# Puppet module names must only include lowercase letters, digits and underscores
558558
name = name.gsub(/[^a-z0-9_]/, '_')
559559
# Puppet module names must not start with a number so if it does, append the letter 'a' to the name. Eg: '7zip' becomes 'a7zip'
560-
name = name.match?(/^\d/) ? "a#{name}" : name # rubocop:disable Lint/UselessAssignment
560+
name = "a#{name}" if name.match?(/^\d/) # rubocop:disable Lint/UselessAssignment
561561
end
562562

563563
# Return a UUID with the dashes turned into underscores to enable the specifying of guaranteed-unique
@@ -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: 4 additions & 4 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...
@@ -511,7 +511,7 @@ def write_pipe(input)
511511
# @param timeout [Float] The number of seconds to wait for the pipe to be readable
512512
# @yield [String] a binary encoded string chunk
513513
# @return nil
514-
def read_from_pipe(pipe, timeout = 0.1, &_block)
514+
def read_from_pipe(pipe, timeout = 0.1, &)
515515
if self.class.readable?(pipe, timeout)
516516
l = pipe.readpartial(4096)
517517
# TODO: Log a debug for "#{Time.now} PIPE> #{l}"

spec/unit/pwsh_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ def output_cmdlet(ps_command, ps_args)
610610
expect(result[:stdout]).to match(/200 OK Glenn/)
611611
expect(result[:stdout]).to match(/DEBUG: 304 Not Modified James/)
612612
# then command may have \r\n injected, so remove those for comparison
613-
expect(result[:stdout].gsub(/\r\n/, '')).to include(command)
613+
expect(result[:stdout].gsub("\r\n", '')).to include(command)
614614
# and it should end with the Write-Error content
615615
expect(result[:stdout]).to match(/404 Craig Not Found/)
616616
end

0 commit comments

Comments
 (0)