Merge pull request #3478 from GauthamGoli/dir_audit_bug_fix

lines_cop: Add condition to prevent false positives
This commit is contained in:
Mike McQuaid 2017-11-24 21:07:07 +00:00 committed by GitHub
commit 6c23892d41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -331,6 +331,7 @@ module RuboCop
end end
find_instance_method_call(body_node, "Dir", :[]) do |method| find_instance_method_call(body_node, "Dir", :[]) do |method|
next unless parameters(method).size == 1
path = parameters(method).first path = parameters(method).first
next unless path.str_type? next unless path.str_type?
next unless match = regex_match_group(path, /^[^\*{},]+$/) next unless match = regex_match_group(path, /^[^\*{},]+$/)