Open AaronC81 opened 5 years ago
class IDNumber < Faker::Base
CHECKS = T.let('TRWAGMYFPDXBNJZSQVHLCKE', T.untyped)
INVALID_SSN = T.let([
/0{3}-\d{2}-\d{4}/,
/\d{3}-0{2}-\d{4}/,
/\d{3}-\d{2}-0{4}/,
/666-\d{2}-\d{4}/,
/9\d{2}-\d{2}-\d{4}/
].freeze, T.untyped)
end
This also happens in Faker :)
YARD doesn't appear to parse heredocs quite right, which means this can't be implemented perfectly now.
Given this file:
module X
A = <<-EOF
bar!
EOF
B = <<-EOF
bar!
EOF
end
p X::A
p X::B
Ruby preserves the indentation properly:
$ ruby test.rb
" bar!\n"
" bar!\n"
But YARD strips the indentation from both of them:
irb(main):010:0> YARD::Registry.root.children.first.children.map(&:value)
=> ["<<-EOF\nbar!\nEOF", "<<-EOF\nbar!\nEOF"]
I'll see if there's an existing issue for this on the YARD repo and open one if not.
Is https://github.com/lsegal/yard/issues/1315 the resulting issue? If so, please take a look at https://github.com/lsegal/yard/pull/1495 🙏
Describe the bug If a constant's value is a HereDoc, the generated RBI contains syntax errors due to the weird syntax of HereDocs in method calls. (I found this when generating an RBI for Rack.)
To Reproduce Generate an RBI for this code:
Expected behavior
Actual behavior