File tree 2 files changed +12
-2
lines changed
2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -236,7 +236,11 @@ def self.translate_plugin_names
236
236
def self . read_config_file
237
237
if File . file? ( CONFIG_FILE )
238
238
require 'yaml'
239
- YAML . load_file ( CONFIG_FILE )
239
+ if YAML . respond_to? ( :safe_load_file )
240
+ YAML . safe_load_file ( CONFIG_FILE , permitted_classes : [ SymbolHash , Symbol ] )
241
+ else
242
+ YAML . load_file ( CONFIG_FILE )
243
+ end
240
244
else
241
245
{ }
242
246
end
Original file line number Diff line number Diff line change 17
17
it "overwrites options with data in ~/.yard/config" do
18
18
expect ( File ) . to receive ( :file? ) . with ( YARD ::Config ::CONFIG_FILE ) . and_return ( true )
19
19
expect ( File ) . to receive ( :file? ) . with ( YARD ::Config ::IGNORED_PLUGINS ) . and_return ( false )
20
- expect ( YAML ) . to receive ( :load_file ) . with ( YARD ::Config ::CONFIG_FILE ) . and_return ( 'test' => true )
20
+ if YAML . respond_to? ( :safe_load_file )
21
+ expect ( YAML ) . to receive ( :safe_load_file )
22
+ . with ( YARD ::Config ::CONFIG_FILE , permitted_classes : [ SymbolHash , Symbol ] )
23
+ . and_return ( 'test' => true )
24
+ else
25
+ expect ( YAML ) . to receive ( :load_file ) . with ( YARD ::Config ::CONFIG_FILE ) . and_return ( 'test' => true )
26
+ end
21
27
YARD ::Config . load
22
28
expect ( YARD ::Config . options [ :test ] ) . to be true
23
29
end
You can’t perform that action at this time.
0 commit comments