File tree Expand file tree Collapse file tree 4 files changed +20
-2
lines changed
Expand file tree Collapse file tree 4 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -920,7 +920,10 @@ Naming/VariableNumber:
920920# SupportedStyles: inline, group
921921Style/AccessModifierDeclarations :
922922 Exclude :
923+ - ' lib/puppet/util/command_line/trollop.rb'
923924 - ' lib/puppet/util/suidmanager.rb'
925+ - ' lib/puppet/util/windows/com.rb'
926+ - ' lib/puppet/util/windows/monkey_patches/process.rb'
924927
925928# This cop supports safe auto-correction (--auto-correct).
926929# Configuration parameters: EnforcedStyle.
Original file line number Diff line number Diff line change 164164
165165 case result
166166 when Array , Hash
167- Puppet ::Util ::Json . dump ( result , :pretty => true )
167+ # JSON < 2.8.0 would pretty print empty arrays and hashes with newlines
168+ # Maintain that behavior for our users for now
169+ if result . is_a? ( Array ) && result . empty?
170+ "[\n \n ]"
171+ elsif result . is_a? ( Hash ) && result . empty?
172+ "{\n }"
173+ else
174+ Puppet ::Util ::Json . dump ( result , :pretty => true )
175+ end
168176 else # one of VALID_TYPES above
169177 result
170178 end
Original file line number Diff line number Diff line change 9191
9292 {
9393 "type_hash" => [ { 'a' => 2 } , "{\n \" a\" : 2\n }" ] ,
94+ "type_empty_hash" => [ { } , "{\n }" ] ,
9495 "type_array" => [ [ ] , "[\n \n ]" ] ,
9596 "type_string" => [ "str" , "str" ] ,
9697 "type_int" => [ 1 , "1" ] ,
Original file line number Diff line number Diff line change 7777
7878 it "raises if given an invalid URI" do
7979 resource [ :source ] = 'h;ttp://rubygems.com'
80- expect { provider . install } . to raise_error ( Puppet ::Error , /Invalid source '': bad URI\( is not URI\? \) / )
80+ # Older versions of URI don't have a space before the opening
81+ # parenthesis in the error message, newer versions do
82+ if Gem ::Version . new ( RUBY_VERSION . dup ) < Gem ::Version . new ( '3.0.0' )
83+ expect { provider . install } . to raise_error ( Puppet ::Error , /Invalid source '': bad URI\( is not URI\? \) / )
84+ else
85+ expect { provider . install } . to raise_error ( Puppet ::Error , /Invalid source '': bad URI \( is not URI\? \) / )
86+ end
8187 end
8288 end
8389 end
You can’t perform that action at this time.
0 commit comments