Alexandros Kosiaris has submitted this change and it was merged. Change subject: RuboCop: fixed Style/DeprecatedHashMethods offense ......................................................................
RuboCop: fixed Style/DeprecatedHashMethods offense Hash#has_key? is deprecated in favor of Hash#key? https://github.com/bbatsov/ruby-style-guide#hash-key Bug: T112651 Change-Id: I856b01aad6ac8f48eb4e83c7daa6eaa8e80cc1d3 --- M .rubocop_todo.yml M modules/labstore/lib/puppet/parser/functions/mount_nfs_volume.rb M modules/wmflib/lib/puppet/parser/functions/ipresolve.rb M modules/wmflib/lib/puppet/parser/functions/os_version.rb M modules/wmflib/lib/puppet/parser/functions/ssl_ciphersuite.rb 5 files changed, 7 insertions(+), 16 deletions(-) Approvals: Alexandros Kosiaris: Looks good to me, approved jenkins-bot: Verified diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 2023e77..00cac4f 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -132,15 +132,6 @@ Exclude: - 'utils/hiera_lookup' -# Offense count: 8 -# Cop supports --auto-correct. -Style/DeprecatedHashMethods: - Exclude: - - 'modules/labstore/lib/puppet/parser/functions/mount_nfs_volume.rb' - - 'modules/wmflib/lib/puppet/parser/functions/ipresolve.rb' - - 'modules/wmflib/lib/puppet/parser/functions/os_version.rb' - - 'modules/wmflib/lib/puppet/parser/functions/ssl_ciphersuite.rb' - # Offense count: 16 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, SupportedStyles. diff --git a/modules/labstore/lib/puppet/parser/functions/mount_nfs_volume.rb b/modules/labstore/lib/puppet/parser/functions/mount_nfs_volume.rb index 78e9ef2..e2bc9eb 100644 --- a/modules/labstore/lib/puppet/parser/functions/mount_nfs_volume.rb +++ b/modules/labstore/lib/puppet/parser/functions/mount_nfs_volume.rb @@ -21,8 +21,8 @@ config = @@labs_nfs_config['private'] project = args[0] mount = args[1] - if config.has_key? project and config[project].has_key? 'mounts' \ - and config[project]['mounts'].has_key? mount + if config.key? project and config[project].key? 'mounts' \ + and config[project]['mounts'].key? mount config[project]['mounts'][mount] else false diff --git a/modules/wmflib/lib/puppet/parser/functions/ipresolve.rb b/modules/wmflib/lib/puppet/parser/functions/ipresolve.rb index e0efa5c..7470ff5 100644 --- a/modules/wmflib/lib/puppet/parser/functions/ipresolve.rb +++ b/modules/wmflib/lib/puppet/parser/functions/ipresolve.rb @@ -38,13 +38,13 @@ end def delete(key) - @cache.delete(key) if @cache.has_key?(key) + @cache.delete(key) if @cache.key?(key) end def is_valid?(key) # If the key exists, and its ttl has not expired, return true. # Return false (and maybe clean up the stale entry) otherwise. - return false unless @cache.has_key?(key) + return false unless @cache.key?(key) t = Time.now.to_i return true if @cache[key].is_valid?t return false @@ -58,7 +58,7 @@ end def read_stale(key) - if @cache.has_key?(key) + if @cache.key?(key) return @cache[key].value end return nil diff --git a/modules/wmflib/lib/puppet/parser/functions/os_version.rb b/modules/wmflib/lib/puppet/parser/functions/os_version.rb index 2b91a4d..dfe3c69 100644 --- a/modules/wmflib/lib/puppet/parser/functions/os_version.rb +++ b/modules/wmflib/lib/puppet/parser/functions/os_version.rb @@ -70,7 +70,7 @@ next unless self_id == other_id - if os_versions[other_id].has_key?(other_release) + if os_versions[other_id].key?(other_release) other_was_codename = true end diff --git a/modules/wmflib/lib/puppet/parser/functions/ssl_ciphersuite.rb b/modules/wmflib/lib/puppet/parser/functions/ssl_ciphersuite.rb index 55a8c65..f542e0a 100644 --- a/modules/wmflib/lib/puppet/parser/functions/ssl_ciphersuite.rb +++ b/modules/wmflib/lib/puppet/parser/functions/ssl_ciphersuite.rb @@ -162,7 +162,7 @@ end ciphersuite = args.shift - unless ciphersuites.has_key?(ciphersuite) + unless ciphersuites.key?(ciphersuite) fail(ArgumentError, "ssl_ciphersuite(): unknown ciphersuite '#{ciphersuite}'") end -- To view, visit https://gerrit.wikimedia.org/r/254428 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I856b01aad6ac8f48eb4e83c7daa6eaa8e80cc1d3 Gerrit-PatchSet: 2 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Zfilipin <zfili...@wikimedia.org> Gerrit-Reviewer: Alexandros Kosiaris <akosia...@wikimedia.org> Gerrit-Reviewer: Dduvall <dduv...@wikimedia.org> Gerrit-Reviewer: Hashar <has...@free.fr> Gerrit-Reviewer: Zfilipin <zfili...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits