Skip to content

Commit d4a1595

Browse files
committed
rubocop: autofix
1 parent 917a54e commit d4a1595

File tree

4 files changed

+30
-26
lines changed

4 files changed

+30
-26
lines changed

.rubocop_todo.yml

Lines changed: 27 additions & 22 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-08 20:12:30 UTC using RuboCop version 1.59.0.
3+
# on 2024-09-05 20:01:51 UTC using RuboCop version 1.64.1.
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
@@ -18,35 +18,40 @@ Performance/RegexpMatch:
1818
RSpec/FilePath:
1919
Enabled: false
2020

21-
# Need to remove logger class variables
21+
# Offense count: 14
2222
Style/ClassVars:
2323
Exclude:
2424
- 'lib/facter/framework/logging/logger.rb'
2525
- 'spec/custom_facts/puppetlabs_spec/files.rb'
26-
- 'spec/facter/util/file_helper_spec.rb'
27-
- 'spec/framework/core/fact/internal/internal_fact_manager_spec.rb'
2826
- 'spec/framework/logging/logger_spec.rb'
2927

28+
# Offense count: 977
29+
# Configuration parameters: AllowedConstants.
3030
Style/Documentation:
31+
Enabled: false
32+
33+
# Offense count: 2
34+
# This cop supports unsafe autocorrection (--autocorrect-all).
35+
Style/IdenticalConditionalBranches:
3136
Exclude:
32-
- 'lib/facter.rb' # should be documented
33-
- 'lib/facter/config.rb' # should be documented
34-
- 'lib/facter/custom_facts/**/*' # should be documented
35-
- 'lib/facter/facts/**/*' # don't care
36-
- 'lib/facter/framework/**/*' # should be documented
37-
- 'lib/facter/models/**/*' # should be documented
38-
- 'lib/facter/resolvers/**/*' # don't care
39-
- 'lib/facter/util/**/*'
40-
- 'lib/facter/version.rb' # auto updated
41-
- 'spec/**/*'
42-
- 'spec_integration/**/*'
43-
- 'scripts/*'
44-
- 'install.rb'
37+
- 'lib/docs/generate.rb'
4538

46-
# While it would be preferable to use a keyword argument for the proxy setting in #get_request and #put_request, if we
47-
# add keyword arguments to those methods Ruby < 3 misinterprets earlier positional arguments as a keyword arguments.
48-
# This is because those positional arguments are hashes that use symbols as keys.
49-
# TODO: revisit this after we drop Ruby < 3 support.
39+
# Offense count: 2
40+
# Configuration parameters: AllowedMethods.
41+
# AllowedMethods: respond_to_missing?
5042
Style/OptionalBooleanParameter:
5143
Exclude:
52-
- 'lib/facter/util/resolvers/http.rb'
44+
- 'lib/facter/util/resolvers/http.rb'
45+
46+
# Offense count: 13
47+
# This cop supports unsafe autocorrection (--autocorrect-all).
48+
Style/SlicingWithRange:
49+
Exclude:
50+
- 'install.rb'
51+
- 'lib/facter/facts/solaris/ldom.rb'
52+
- 'lib/facter/framework/cli/cli.rb'
53+
- 'lib/facter/resolvers/aix/serialnumber.rb'
54+
- 'lib/facter/resolvers/freebsd/swap_memory.rb'
55+
- 'lib/facter/resolvers/networking.rb'
56+
- 'lib/facter/resolvers/partitions.rb'
57+
- 'lib/facter/util/api_debugger.rb'

lib/docs/generate.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def format_facts(fact_hash)
2121
erb = if ERB.instance_method(:initialize).parameters.assoc(:key) # Ruby 2.6+
2222
ERB.new(File.read(PATH_TO_TEMPLATE), trim_mode: '-')
2323
else
24-
ERB.new(File.read(PATH_TO_TEMPLATE), nil, '-')
24+
ERB.new(File.read(PATH_TO_TEMPLATE), trim_mode: '-')
2525
end
2626
erb.result(scope.instance_eval { binding })
2727
end

lib/facter/custom_facts/core/execution/base.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def with_env(values)
2626
ENV[var] = value
2727
end
2828
# execute the caller's block, capture the return value
29-
rv = yield
29+
yield
3030
# use an ensure block to make absolutely sure we restore the variables
3131
ensure
3232
# restore the old values
@@ -39,7 +39,6 @@ def with_env(values)
3939
end
4040
end
4141
# return the captured return value
42-
rv
4342
end
4443

4544
def execute(command, options = {})

lib/facter/framework/cli/cli.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def man(*args)
113113
negate_options = %w[block cache custom_facts external_facts]
114114

115115
template = File.join(File.dirname(__FILE__), '..', '..', 'templates', 'man.erb')
116-
erb = ERB.new(File.read(template), nil, '-')
116+
erb = ERB.new(File.read(template), trim_mode: '-')
117117
erb.filename = template
118118
puts erb.result(binding)
119119
end

0 commit comments

Comments
 (0)