-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
undefined method `visibility' for nil:NilClass #2
Comments
Just from the stacktrace it looks like the error is happening within the Yardstick::Method module, which is mixed into I'll try running the code against your repo later on. In the meantime, you could try running it against parts of the source code until you narrow down which file the problem is happening with. The most likely problem is that YARD has a bug in it's parser and is being tripped up by something specific in one place within the source. |
Should have thought of that. It's the app/models/document.rb file. In particular, it seems to be the following snippet: # Faceted browsing information that was returned by the last search
#
# For the purposes of faceted browsing, the Solr server (as configured by
# default in RLetters) returns the number of items within the current search
# with each author, journal, or publication decade.
#
# @api public
# @return [Hash] facets returned by the last search, +nil+ if none.
# The hash contains the following keys:
# Document.facets[:author]["Particular Author"] = Integer
# Document.facets[:journal]["Particular Journal"] = Integer
# Document.facets[:year]["1980"] = Integer
# The +:year+ facet is handled specially: the value for "1980" is the
# facet count for the entire decade 1980-1989.
#
# @example Get the number of documents in the last search published by W. Shatner
# shatner_docs = Document.facets[:author]["W. Shatner"]
cattr_reader :facets
# Number of documents returned by the last search
#
# Since the search results are almost always limited by the per-page count,
# this variable returns the full number of documents that were returned by
# the last search.
#
# @return [Integer] number of documents in the last search
cattr_reader :num_results Remove the docstring on only one of these, and it still crashes. Remove both docstrings, and it works. Can you spot anything obviously crazy here? |
Hmm. Nothing obvious stands out for me. Sometimes when there are parsing errors (not just YARD, but in general I've noticed) the error could actually be above wherever the problem is manifesting. Like for example, maybe there's something that put the parser in an invalid state above this code. What I might start by doing is a kind of binary search; removing all of the docs from the halfway mark down, see if the problem stays or goes away, and then keep dividing the doc up until you zero in on it. |
Okay, I've pruned it down to a minimal example and posted it here. It seems that YARD/Yardstick doesn't like |
@cpence: it wouldn't be anything to do with Yardstick, but YARD itself. What you want to do is write a YARD handler that identifies the Here's two examples of YARD handlers, but you may be able to find more through github/google search: https://github.com/postmodern/yard-dm-is-predefined By itself YARD has no knowledge of DSL methods like https://github.com/postmodern/yard-dm/blob/master/lib/yard-dm/belongs_to_handler.rb |
1 similar comment
@cpence: it wouldn't be anything to do with Yardstick, but YARD itself. What you want to do is write a YARD handler that identifies the Here's two examples of YARD handlers, but you may be able to find more through github/google search: https://github.com/postmodern/yard-dm-is-predefined By itself YARD has no knowledge of DSL methods like https://github.com/postmodern/yard-dm/blob/master/lib/yard-dm/belongs_to_handler.rb |
I'm going to keep this ticket open though because it looks like I need to handle cases where YARD is parsing what looks to be like a method's documentation, but it doesn't know which method to associate the docs with. |
Awesome, thanks for the help on this. And agreed that there should be some way for Yardstick to recover when it can -- or at least print a pretty error message. |
A related point that does pertain only to Yardstick: now that I have a functioning DSL handler for |
I'm getting the same error from Yardstick (0.0.1), with no complaint from YARD (0.7.4). Here's the code: http://pastie.org/3087569 |
I'm having a strange error when running yardstick on my code base. It's been running fine for quite a while now, and has been really helpful in getting my documentation quality up, so I'd love to figure out what's gone wrong. Unfortunately, pecking through the code I can't seem to make heads or tails of what's gone wrong.
Running Ruby 1.9.2 (installed via RVM). The project is available here, and the current Git HEAD is precisely the set of code that's causing this error, if it would help to run things yourself. I can duplicate the error on two machines (with Ruby 1.9.2 and Yardstick 0.4.0), so I don't think it's a problem with my machine or Ruby setup.
Let me know if there's anything else I can do to help!
Backtrace follows:
The text was updated successfully, but these errors were encountered: