lib/rubocop/cop/style/hash_syntax.rb in rubocop-1.48.1 vs lib/rubocop/cop/style/hash_syntax.rb in rubocop-1.49.0
- old
+ new
@@ -86,10 +86,13 @@
#
# # good
# {foo: foo, bar: bar}
#
# # good
+ # {foo: foo, bar:}
+ #
+ # # good
# {foo:, bar:}
#
# @example EnforcedShorthandSyntax: consistent
#
# # bad - `foo` and `bar` values can be omitted
@@ -205,10 +208,10 @@
# Most hash keys can be matched against a simple regex.
return true if /\A[_a-z]\w*[?!]?\z/i.match?(sym_name)
# For more complicated hash keys, let the parser validate the syntax.
- ProcessedSource.new("{ #{sym_name}: :foo }", target_ruby_version).valid_syntax?
+ parse("{ #{sym_name}: :foo }").valid_syntax?
end
def check(pairs, delim, msg)
pairs.each do |pair|
if pair.delimiter == delim