File tree Expand file tree Collapse file tree 7 files changed +19
-18
lines changed Expand file tree Collapse file tree 7 files changed +19
-18
lines changed Original file line number Diff line number Diff line change @@ -205,19 +205,6 @@ Style/FormatStringToken:
205205 - ' lib/facter/resolvers/amzn/os_release_rpm.rb'
206206 - ' spec/facter/resolvers/amzn/os_release_rpm_spec.rb'
207207
208- # Offense count: 6
209- # This cop supports unsafe autocorrection (--autocorrect-all).
210- # Configuration parameters: EnforcedStyle.
211- # SupportedStyles: always, always_true, never
212- Style/FrozenStringLiteralComment :
213- Exclude :
214- - ' lib/facter/custom_facts/core/execution/posix.rb'
215- - ' lib/facter/custom_facts/core/execution/windows.rb'
216- - ' lib/facter/custom_facts/util/resolution.rb'
217- - ' spec/custom_facts/core/execution/posix_spec.rb'
218- - ' spec/custom_facts/core/execution/windows_spec.rb'
219- - ' spec/custom_facts/util/normalization_spec.rb'
220-
221208# Offense count: 5
222209# This cop supports unsafe autocorrection (--autocorrect-all).
223210Style/GlobalStdStream :
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
13module Facter
24 module Core
35 module Execution
@@ -44,7 +46,8 @@ def expand_command(command)
4446
4547 return unless exe && ( expanded = which ( exe ) )
4648
47- expanded = "'#{ expanded } '" if /\s / . match? ( expanded )
49+ expanded = expanded . dup
50+ expanded = +"'#{ expanded } '" if /\s / . match? ( expanded )
4851 expanded << " #{ args } " if args
4952
5053 expanded
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
13module Facter
24 module Core
35 module Execution
@@ -56,7 +58,8 @@ def expand_command(command)
5658
5759 return unless exe && ( expanded = which ( exe ) )
5860
59- expanded = "\" #{ expanded } \" " if /\s +/ . match? ( expanded )
61+ expanded = expanded . dup
62+ expanded = +"\" #{ expanded } \" " if /\s +/ . match? ( expanded )
6063 expanded << " #{ args } " if args
6164
6265 expanded
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
13# This represents a fact resolution. A resolution is a concrete
24# implementation of a fact. A single fact can have many resolutions and
35# the correct resolution will be chosen at runtime. Each time
@@ -88,7 +90,7 @@ def resolution_type
8890 # @api private
8991 def evaluate ( &block )
9092 if @last_evaluated
91- msg = "Already evaluated #{ @name } "
93+ msg = + "Already evaluated #{ @name } "
9294 msg << " at #{ @last_evaluated } " if msg . is_a? String
9395 msg << ', reevaluating anyways'
9496 log . warn msg
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
13describe Facter ::Core ::Execution ::Posix , unless : LegacyFacter ::Util ::Config . windows? do
24 let ( :posix_executor ) { Facter ::Core ::Execution ::Posix . new }
35
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
13describe Facter ::Core ::Execution ::Windows do
24 let ( :executor ) { Facter ::Core ::Execution ::Windows . new }
35
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
13describe LegacyFacter ::Util ::Normalization do
24 subject ( :normalization ) { LegacyFacter ::Util ::Normalization }
35
@@ -44,15 +46,15 @@ def utf8(str)
4446 end
4547
4648 it 'rejects strings that are not UTF-8 and do not match their claimed encoding' do
47- invalid_shift_jis = "\xFF \x5C !" . force_encoding ( Encoding ::SHIFT_JIS )
49+ invalid_shift_jis = ( + "\xFF \x5C !" ) . force_encoding ( Encoding ::SHIFT_JIS )
4850 expect do
4951 normalization . normalize ( invalid_shift_jis )
5052 end . to raise_error ( LegacyFacter ::Util ::Normalization ::NormalizationError ,
5153 /String encoding Shift_JIS is not UTF-8 and could not be converted to UTF-8/ )
5254 end
5355
5456 it "rejects strings that claim to be UTF-8 encoded but aren't" do
55- str = "\255 ay!" . force_encoding ( Encoding ::UTF_8 )
57+ str = ( + "\255 ay!" ) . force_encoding ( Encoding ::UTF_8 )
5658 expect do
5759 normalization . normalize ( str )
5860 end . to raise_error ( LegacyFacter ::Util ::Normalization ::NormalizationError ,
You can’t perform that action at this time.
0 commit comments