Skip to content

Commit 653538a

Browse files
committed
rubocop: fix Style/PreferredHashMethods
1 parent 06442a5 commit 653538a

4 files changed

Lines changed: 5 additions & 15 deletions

File tree

.rubocop_todo.yml

Lines changed: 1 addition & 11 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 2026-02-04 04:11:21 UTC using RuboCop version 1.81.7.
3+
# on 2026-02-04 04:17:01 UTC using RuboCop version 1.81.7.
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
@@ -255,16 +255,6 @@ Style/OptionalBooleanParameter:
255255
Exclude:
256256
- 'lib/puppet_references/puppet/strings.rb'
257257

258-
# Offense count: 4
259-
# This cop supports unsafe autocorrection (--autocorrect-all).
260-
# Configuration parameters: EnforcedStyle.
261-
# SupportedStyles: short, verbose
262-
Style/PreferredHashMethods:
263-
Exclude:
264-
- 'lib/puppet_docs/auto_redirects.rb'
265-
- 'lib/puppet_docs/config.rb'
266-
- 'source/_plugins/partial.rb'
267-
268258
# Offense count: 1
269259
# This cop supports unsafe autocorrection (--autocorrect-all).
270260
# Configuration parameters: EnforcedStyle, AllowedCompactTypes.

lib/puppet_docs/auto_redirects.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def self.generate(config, redirects_yaml)
3838
latest = "/#{doc}/latest"
3939

4040
# First, bail out unless the doc exists and this is a valid version.
41-
if config['document_version_index'][doc].class != Hash || !config['document_version_index'][doc].has_key?(at_version)
41+
if config['document_version_index'][doc].class != Hash || !config['document_version_index'][doc].key?(at_version)
4242
puts "Skipping bad auto-redirect (make sure the syntax is right and the version exists!): #{redirect}"
4343
memo
4444
else

lib/puppet_docs/config.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@ def initialize(config_file)
6969

7070
# Reject any non-existent versions (they'll fall back to latest):
7171
data['my_versions'].reject! do |group, version|
72-
!self['document_version_index'][group].has_key?(version)
72+
!self['document_version_index'][group].key?(version)
7373
end
7474

7575
# The third rule of Tautology Club: my own version is my version.
7676
data['my_versions'][ data['doc'] ] = data['version']
7777
# As for the rest of our known document groups...
7878
other_groups = document_groups - [data['doc']]
7979
# If we have an explicit version for a given group, keep it:
80-
unknown_groups = other_groups.reject { |group| data['my_versions'].has_key?(group) }
80+
unknown_groups = other_groups.reject { |group| data['my_versions'].key?(group) }
8181

8282
unknown_groups.each do |group|
8383
# Compile a list of the target group's versions that claim this version:

source/_plugins/partial.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def render(context)
131131
real_file = sourcedir + absolute_url.relative_path_from(root)
132132

133133
# Add partial to dependency tree
134-
if context.registers[:page] && context.registers[:page].has_key?('path')
134+
if context.registers[:page] && context.registers[:page].key?('path')
135135
site.regenerator.add_dependency(
136136
site.in_source_dir(context.registers[:page]['path']),
137137
real_file.to_s,

0 commit comments

Comments
 (0)