sfcgeorge / yard-contracts

YARD Plugin for Automatic Param Docs from Contracts.
MIT License
26 stars 3 forks source link

Warning from yard when passing a hash #10

Open fappelman opened 9 years ago

fappelman commented 9 years ago

I have the following method:

class Operation

  Contract ({ "operation_type" => String, "operation_id" => String, "file_path" => String }) => Any
  def initialize(record)
  end
end

When run yard produces the following warning:

[warn]: In file `operation.rb':1: Cannot resolve link to "operation_type"=>String, from text.

What does that mean? The documentation generated is not particularly clean.The description is the second and third element of the Hash.

Thanks.

Fred
sfcgeorge commented 9 years ago

I'll check this out, but I have a feeling YARD is trying to lookup a class to add a link to it. E.g. if you have a class Foo and a method with a parameter of type Foo then you'll be able to click the Foo in the param description to be taken to the Foo class documentation.

I have to work out why YARD is trying to do that here, I probably need to escape something because YARD is getting confused.

You're right that the documentation is a bit ugly when hashes are involved, I think fixing #4 will improve that. Hopefully I'll get to that soon.