-
-
Notifications
You must be signed in to change notification settings - Fork 74
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
Non-existent method being reported #49
Comments
I'm confused as to what the problem is for you. What are you expecting to see, and what's different from that? Dynamically generated code doesn't have a file/line. Is that the problem? Or is it something else? |
But is there code being dynamically generated? This is just a single file, that Basically, I'd expect not to see the line |
To clarify OP complaint (note that sample is a complete file, so describe does not generate anything)
If you look at sexp, there is no defn, but it is still reported as a method s(:iter,
s(:call, nil, :describe, s(:str, "Callback")),
s(:args),
s(:module,
:LibTest,
s(:call, nil, :extend, s(:colon2, s(:const, :FFI), :Library)))) |
That's because flog treats top-level forms of iter as "methods". Rake tasks, tests, etc. |
from task :woot do
sh "echo woot"
end |
So, yeah, that's the "problem" here. The top level describe is being reported and the inner module is too. |
That makes perfect sense. Just like $ flog -a test.rb
1.0: flog total
1.0: flog/method average
1.0: describe#Callback test.rb:1 from describe "Callback" do
end This is fine. But go back to my original example. Is this really intended? The "method" is even missing its file and line. |
I suspect the problem is that it should say:
instead of:
|
I guess that would make sense. From my limited testing, this also happens with other methods like |
They're method calls, so yes. |
This is a problem with MethodBasedSexpProcessor#in_klass in sexp_processor. I've fixed it and will release it soon. |
Superb! Sorry if my bug report wasn't clear. Thanks! 😄 |
Hey @zenspider, just to clarify, has this been fixed? With the most recent version of sexp_processor (4.4.4), flog no longer reports:
but instead reports:
You said this should probably be reported as |
Here's what I see for the following source: describe "OK" do
extend FFI::Library
end
describe "Bad" do
module LibTest
extend FFI::Library
end
end Running flog on that w/
The thing that's confusing is the Code inside the module looks like Flog doesn't know that I guess we could try to come up with some logic to try to determine the context better... but I think a module inside a method inside a module inside a method is just gonna be confusing no matter what you try to do to the logic. |
This is a small code sample that I extracted from the ffi gem's spec:
I'm not sure if this is a flog or sexp_processor issue, but here's what's happening when I run flog:
Basically, calling
extend
somehow leads to aCallback
method being reported. Also, since this method doesn't exist, sexp_processor'smethod_locations
doesn't include it, which is why the flog report does not include the file and line of the method.If you could just point me in the right direction, I might be able to fix this.
The text was updated successfully, but these errors were encountered: