Skip to content
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 `captures' for nil:NilClass #306

Closed
Yahsaswi opened this issue May 5, 2017 · 11 comments
Closed

undefined method `captures' for nil:NilClass #306

Yahsaswi opened this issue May 5, 2017 · 11 comments

Comments

@Yahsaswi
Copy link

Yahsaswi commented May 5, 2017

While running slather over a sample test and found this issue : Slathering...
undefined method `captures' for nil:NilClass

Are you sure your project is generating coverage? Make sure you enable code coverage in the Test section of your Xcode scheme.
Did you specify your Xcode scheme? (--scheme or 'scheme' in .slather.yml)
If you're using a workspace, did you specify it? (--workspace or 'workspace' in .slather.yml)

/Library/Ruby/Gems/2.0.0/gems/slather-2.4.1/lib/slather/project.rb:239:in configure': undefined method captures' for nil:NilClass (NoMethodError)
from /Library/Ruby/Gems/2.0.0/gems/slather-2.4.1/lib/slather/command/coverage_command.rb:53:in execute' from /Library/Ruby/Gems/2.0.0/gems/clamp-0.6.5/lib/clamp/command.rb:67:in run'
from /Library/Ruby/Gems/2.0.0/gems/clamp-0.6.5/lib/clamp/subcommand/execution.rb:11:in execute' from /Library/Ruby/Gems/2.0.0/gems/clamp-0.6.5/lib/clamp/command.rb:67:in run'
from /Library/Ruby/Gems/2.0.0/gems/clamp-0.6.5/lib/clamp/command.rb:132:in run' from /Library/Ruby/Gems/2.0.0/gems/slather-2.4.1/bin/slather:17:in <top (required)>'
from /usr/local/bin/slather:23:in load' from /usr/local/bin/slather:23:in

'

@ksuther
Copy link
Contributor

ksuther commented May 5, 2017

What is your slather command? It sounds like it isn't able to read your xcodeproj.

@Yahsaswi
Copy link
Author

Yahsaswi commented May 5, 2017

slather coverage --html --scheme SampleOCMock SampleOCMock.xcodeproj

@ksuther
Copy link
Contributor

ksuther commented May 5, 2017

Have you tried coverage instead of gcovr?

slather coverage --html --scheme SampleOCMock SampleOCMock.xcodeproj

@Yahsaswi
Copy link
Author

Yahsaswi commented May 5, 2017

Sorry that was a typo I tried that only
"slather coverage --html --scheme SampleOCMock SampleOCMock.xcodeproj"

@ksuther
Copy link
Contributor

ksuther commented May 5, 2017

Is this project publicly available? Your best bit is to step through slather and see why it's failing to load the xcodeproj (lib/slather/command/coverage_command.rb in the project method).

@Yahsaswi
Copy link
Author

Yahsaswi commented May 8, 2017

The error is not specific to the project. I couldn't run it over any project. Could you please help me with the steps that I need to follow for running slather for any Xcode 7 project to check if I'm missing something (with any possible situations where it could fail).

@ksuther
Copy link
Contributor

ksuther commented May 8, 2017

Your slather command looks correct, so something internally is likely wrong. The simplest thing you can do is try adding some print statements to see why the xcodeproj isn't able to load (in the file I mentioned above).

@ButkiewiczP
Copy link
Contributor

ButkiewiczP commented May 16, 2017

@Yahsaswi Are you running Xcode 7? I found this error to be an issue with parsing the LLVM version information when Xcode 7 was active (whether by xcode-select or by being the only version available).

I've posted pull request #308 that fixes the issue, so hopefully @ksuther can take a look at that and get it merged in. This issue (as far as I can tell) is a blocker for anyone using Xcode 7.

For what it's worth, it looks like this commit is what introduced this crash: 059c3fa

@ksuther
Copy link
Contributor

ksuther commented May 16, 2017

Thanks @ButkiewiczP! Can you try with slather 2.4.2?

@ButkiewiczP
Copy link
Contributor

@ksuther Just tested this on separate Xcode 7 and 8 projects successfully.

@Yahsaswi
Copy link
Author

Yahsaswi commented May 16, 2017

I was working on Xcode 7. Thank you for your response @ksuther and @ButkiewiczP . It is working now !!

@ksuther ksuther closed this as completed May 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants