Skip to content

Commit

Permalink
Merge pull request Shopify#171 from Shopify/remove-yaml-warning
Browse files Browse the repository at this point in the history
Remove YAML.safe_load warning
  • Loading branch information
etiennebarrie committed May 21, 2020
2 parents daf34bb + 822d468 commit 73da79d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ GEM
nokogiri (1.10.9)
mini_portile2 (~> 2.4.0)
parallel (1.19.1)
parser (2.7.0.2)
parser (2.7.1.2)
ast (~> 2.4.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
Expand Down
10 changes: 8 additions & 2 deletions lib/erb_lint/file_loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@ def initialize(base_path)
@base_path = base_path
end

def yaml(filename)
YAML.safe_load(read_content(filename), [Regexp, Symbol], [], false, filename) || {}
if RUBY_VERSION >= "2.6"
def yaml(filename)
YAML.safe_load(read_content(filename), permitted_classes: [Regexp, Symbol], filename: filename) || {}
end
else
def yaml(filename)
YAML.safe_load(read_content(filename), [Regexp, Symbol], [], false, filename) || {}
end
end

private
Expand Down

0 comments on commit 73da79d

Please sign in to comment.