Giter VIP home page Giter VIP logo

slather's Introduction

Slather Logo

Gem Version Build Status Coverage Status

Generate test coverage reports for Xcode projects & hook it into CI.

Projects that use Slather

Project Coverage
Parsimmon Parsimmon Coverage
VENCore VENCore Coverage
DAZABTest DAZABTest Coverage
TBStateMachine TBStateMachine Coverage

Installation

Add this line to your application's Gemfile:

gem 'slather'

And then execute:

$ bundle

Or install the gem:

gem install slather

Usage

Enable test coverage by ticking the "Gather coverage data" checkbox when editing a scheme:

To verify you're ready to generate test coverage, run your test suite on your project, and then run:

$ slather coverage -s --scheme YourXcodeSchemeName path/to/project.xcodeproj

If you use a workspace in Xcode you need to specify it:

$ slather coverage -s --scheme YourXcodeSchemeName --workspace path/to/workspace.xcworkspace path/to/project.xcodeproj

If you use a different configuration for your tests:

$ slather coverage -s --scheme YourXcodeSchemeName --configuration YourBuildConfigurationName path/to/project.xcodeproj

If your configuration produces a universal binary you need to specify a specific architecture to use:

$ slather coverage -s --arch x86_64 --scheme YourXcodeSchemeName --configuration YourBuildConfigurationName path/to/project.xcodeproj

For multiple modules

If you want to run some modules, but not all (like modules created by CocoaPods) you can do it like this:

$ slather coverage --binary-basename module1 --binary-basename module2 path/to/project.xcodeproj

You can also add it to the .slather.yml file as an array:

binary_basename:
  - module1
  - module2

Setup for Xcode 5 and 6

Run this command to enable the Generate Test Coverage and Instrument Program Flow flags for your project:

$ slather setup path/to/project.xcodeproj

General Usage Notes

Commandline Arguments Win

When using both a config file (.slather.yml) and providing arguments via the commandline, the arguments will take precedence over the matching setting in the config file.

ignore always wins over source-files

When defining both files that should be ignored (--ignore, ignore) and source files to include (--source-files, source_files), the ignore list is checked first. If the file being scanned matches a glob in the ignore list, it will not be included. In this case, the source_file list is not checked.

If the file being scanned is not in the ignore list, and source_file has been defined, the source_file list is checked. If the source file matches a glob, it will be included.

CI Integration

Usage with Codecov

Login to Codecov (no need to activate a repository, this happens automatically). Right now, slather supports Codecov via all supported CI providers listed here.

Make a .slather.yml file:

# .slather.yml

coverage_service: cobertura_xml
xcodeproj: path/to/project.xcodeproj
scheme: YourXcodeSchemeName
configuration: TestedConfiguration
source_directory: path/to/sources/to/include
output_directory: path/to/xml_report
ignore:
  - ExamplePodCode/*
  - ProjectTestsGroup/*

And then in your .travis.yml, circle.yml (or after test commands in other CI providers), call slather after a successful build:

# .travis.yml

before_install: rvm use $RVM_RUBY_VERSION
install: bundle install --without=documentation --path ../travis_bundle_dir
after_success: 
  - slather
  - bash <(curl -s https://codecov.io/bash) -f path/to/xml_report/cobertura.xml -X coveragepy -X gcov -X xcode
# circle.yml

test:
  post:
    - bundle exec slather
    - bash <(curl -s https://codecov.io/bash) -f path/to/xml_report/cobertura.xml -X coveragepy -X gcov -X xcode

Private repo? Add -t :uuid-repo-token to the codecov uploader. Read more about uploading report to Codecov here

Usage with Coveralls

Login to Coveralls and enable your repository. Right now, slather supports Coveralls via Travis CI, CircleCI, Jenkins, Teamcity, Buildkite, and Bitrise.

Make a .slather.yml file and specify the CI Service you're using:

# .slather.yml

ci_service: circleci | travis_ci | travis_pro | jenkins | buildkite | teamcity
coverage_service: coveralls
xcodeproj: path/to/project.xcodeproj
scheme: YourXcodeSchemeName
ignore:
  - ExamplePodCode/*
  - ProjectTestsGroup/*

And then in your .travis.yml or circle.yml or github-action.yml, call slather after a successful build:

# .travis.yml

before_install: rvm use $RVM_RUBY_VERSION
install: bundle install --without=documentation --path ../travis_bundle_dir
after_success: slather
# circle.yml

test:
  post:
    - bundle exec slather
# github-action.yml
  myjob:
    steps:
      - run: |
          bundle config path vendor/bundle
          bundle install --without=documentation --jobs 4 --retry 3
      - name: Extract branch name
        shell: bash
        run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
        id: get_branch
      - run: bundle exec slather
        env:
          GIT_BRANCH: ${{ steps.get_branch.outputs.branch }}
          CI_PULL_REQUEST: ${{ github.event.number }}
          COVERAGE_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Usage with Travis CI Pro

To use Coveralls with Travis CI Pro (for private repos), add following lines along with other settings to .slather.yml:

# .slather.yml

ci_service: travis_pro
coverage_access_token: <YOUR ACCESS TOKEN>

The coverage token can be found at Coveralls repo page. Or it can be passed in via the COVERAGE_ACCESS_TOKEN environment var.

Cobertura

To create a Cobertura XML report set cobertura_xml as coverage service inside your .slather.yml. Optionally you can define an output directory for the XML report:

# .slather.yml

coverage_service: cobertura_xml
xcodeproj: path/to/project.xcodeproj
scheme: YourXcodeSchemeName
source_directory: path/to/sources/to/include
output_directory: path/to/xml_report
ignore:
  - ExamplePodCode/*
  - ProjectTestsGroup/*

Or use the command line options --cobertura-xml or -x and --output-directory:

$ slather coverage -x --output-directory path/to/xml_report

Static HTML

To create a report as static html pages, use the command line options --html:

$ slather coverage --html --scheme YourXcodeSchemeName path/to/project.xcodeproj

This will make a directory named html in your root directory (unless --output-directory is specified) and will generate all the reports as static html pages inside the directory. It will print out the report's path by default, but you can also specify --show flag to open it in your browser automatically.

By default, the generated HTML will reference locally hosted assets (js, css). You can specify the --cdn-assets to specify that you prefer for the generated HTML to use externally hosted assets. This can be useful if publishing the HTML file as a build artifact.

TeamCity Reporting

To report the coverage statistics to TeamCity:

$ slather coverage --teamcity -s --scheme YourXcodeSchemeName

Coverage for code included via CocoaPods

If you're trying to compute the coverage of code that has been included via CocoaPods, you will need to tell CocoaPods to use the Slather plugin by adding the following to your Podfile.

plugin 'slather'

You will also need to tell Slather where to find the source files for your Pod.

# .slather.yml

source_directory: Pods/AFNetworking

Custom Build Directory

Slather will look for the test coverage files in DerivedData by default. If you send build output to a custom location, like this, then you should also set the build_directory property in .slather.yml

Building in a workspace

Include the --workspace argument or add workspace to .slather.yml if you build your project in a workspace. For example:

$ slather coverage --html --scheme YourXcodeSchemeName --workspace path/to/workspace.xcworkspace path/to/project.xcodeproj

Contributing

We’d love to see your ideas for improving this library! The best way to contribute is by submitting a pull request. We’ll do our best to respond to your patch as soon as possible. You can also submit a new GitHub issue if you find bugs or have questions. :octocat:

Please make sure to follow our general coding style and add test coverage for new features!

Contributors

slather's People

Contributors

alisoftware avatar ayanonagon avatar blackm00n avatar bootstraponline avatar cltnschlosser avatar dlackty avatar dnedrow avatar eliperkins avatar fermoyadrop avatar grime2d avatar hborawski avatar ikhsan avatar jarrodlombardo-eventbase avatar jhersh avatar joshrlesch avatar ksuther avatar kylef avatar marklarr avatar martin-key avatar matej avatar michaelmyers avatar neonichu avatar onato avatar paulz avatar pietbrauer avatar sshirokov-mwb avatar sushant-here avatar thasegaw avatar viteinfinite avatar weibel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

slather's Issues

[Question] Multiple projects in a workspace

We have a single repo that has multiple projects under a single workspace because they share dependancies. We handle testing with a shared scheme that builds the test targets for each project.
Is there a way to setup slather to handle this scenario?

Exclude paths with profdata

I am using your feature-profdata branch for generating code coverage within my apps. I wanted to know when this will become part of a new release?

Also how can I exclude paths from the cobertura reports.

Even with ignore paths from my pods in the .yml file and bundle exec slather command I still get Pods in my results.

Any ideas where I might be going wrong.

slather on CircleCI not sending to Coveralls

I'm running slather on CircleCI objective-c project. Slather runs without error and without any output other than:
Slathering...
Slathered.

However, nothing gets sent to Coveralls. I can run slather with coverage --html and that does produce a coverage report on CircleCI

I have set my github repo token in CircleCI Environment Variable: COVERALLS_REPO_TOKEN

.slather.yml:
ci_service: circleci
coverage_service: coveralls
xcodeproj: ObjectiveCBootstrap.xcodeproj
source_directory: ./

circle.yml:
machine:
xcode:
version: "7.0"
test:
override:
- xcodebuild test -project ObjectiveCBootstrap.xcodeproj -scheme ObjectiveCBootstrap -destination 'platform=iOS Simulator,name=iPhone 6,OS=9.0' ONLY_ACTIVE_ARCH=NO TEST_AFTER_BUILD=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES
post:
- bundle exec slather

slather is not picking up coverage files

Slather is not picking up the .gcno files in my project's build directory. To prove this, I ran tree on the folder where my project was built and grepped for the files on travis. They're there.

screen shot 2015-03-27 at 11 40 26 pm

My slather config:

coverage_service: coveralls
xcodeproj: paq.xcodeproj
ignore:
  - catch.hpp

Looking at slather's source, it looks like it either thinks the file has no source file, or that it is in my ignore list. Neither seems to be true.

Is there any way to disable the "no source file" check? I can explicitly give slather the correct build directory to look in using the -b flag, so it can just blindly take all the .gcno files in there.

Slather can't find the default test target gcda files.

Hi guys!

I was trying to use slather for the first time and noticed that it couldn't find the gcda coverage files for my test target, specifying the exact location of the test target with the -b flag fixed it.

Is this working the way it is intended to work or is there something about my project configuration that makes it fail?

I'm using Xcode 6.1.1 and my tests are strictly unit tests built into a separate target (I'm not hooking the tests on the actual application).

Thank you!

Tests fail locally, but pass on travis

I'm currently trying to add functionality to slather to output coverage files as static htmls. I've already added the basic functionality in my branch and currently trying to add tests to cover those up.

Although, I had a problem when running the tests in my local machine. I'm currently running Mac OS X 10.10.3, ruby 2.0.0p481 and Xcode 6.3.1. What I did was:

  • Clone repo
  • bundle install
  • bundle exec rspec

Firstly, I have a warning from iPhone simulator saying that the service could not established. Here is the warning message:
xcodebuild[3176:118116] [MT] iPhoneSimulator: SimVerifier returned: Error Domain=NSPOSIXErrorDomain Code=53 "Simulator verification failed." UserInfo=0x7f91a1d6e280 {NSLocalizedFailureReason=A connection to the simulator verification service could not be established., NSLocalizedRecoverySuggestion=Ensure that Xcode.app is installed on a volume with ownership enabled., NSLocalizedDescription=Simulator verification failed.}

Secondly, I have 3 tests failing, which all related to the fixture Branches.m on line 13. It seems that somehow the generated outputs differ from the fixture files. Below are my rspec failures:

  1) Slather::CoverageService::CoberturaXmlOutput#post should create an XML report spanning all coverage files
     Failure/Error: EquivalentXml.equivalent?(current_xml_doc, fixture_xml_doc).should be_truthy
       expected: truthy value
            got: false
     # ./spec/slather/coverage_service/cobertura_xml_spec.rb:38:in `block (3 levels) in <top (required)>'

  2) Slather::CoverageService::GutterJsonOutput#post should print out the coverage for each file, and then total coverage
     Failure/Error: expect(current_json).to be_json_eql(fixture_json)
       Expected equivalent JSON
       Diff:

       @@ -185,10 +185,9 @@
                "short_text": "-"
              },
              {
       -        "background_color": "0x35CC4B",
                "line": 13,
                "long_text": "",
       -        "short_text": "2"
       +        "short_text": "-"
              },
              {
                "line": 14,

       @@ -432,10 +431,9 @@
                "short_text": "-"
              },
              {
       -        "background_color": "0xFC635E",
                "line": 13,
                "long_text": "",
       -        "short_text": "#####"
       +        "short_text": "-"
              },
              {
                "line": 14,
     # ./spec/slather/coverage_service/gutter_json_spec.rb:26:in `block (3 levels) in <top (required)>'

  3) Slather::CoverageService::SimpleOutput#post should print out the coverage for each file, and then total coverage
     Failure/Error: fixtures_project.post
       #<Slather::Project> path:`/Users/ikhsan/Open Source/slather/spec/fixtures/fixtures.xcodeproj` UUID:`8C9A2025195965F00013B6B3` received :puts with unexpected arguments
         expected: ("spec/fixtures/fixtures/fixtures.m: 2 of 4 lines (50.00%)")
              got: ("spec/fixtures/fixtures/more_files/Branches.m: 9 of 19 lines (47.37%)")
     # ./lib/slather/coverage_service/simple_output.rb:23:in `block in post'
     # ./lib/slather/coverage_service/simple_output.rb:13:in `each'
     # ./lib/slather/coverage_service/simple_output.rb:13:in `post'
     # ./spec/slather/coverage_service/simple_output_spec.rb:32:in `block (3 levels) in <top (required)>'

In contradiction, I pushed the same commit to run it on travis. It works fine. I'd really appreciate it if you guys could shed some light on how to run the tests properly.

Many thanks for this wonderful library! 👍

Allow passing Coveralls repo token on CLI or as ENV var

File this under question or feature request:

In their repo setup instructions, Coveralls warns against making your repo token public. There are ways to do this for projects running PR builds on a public repo—though they aren't exactly bullet-proof. It would be nice if slather supported passing the repo token using command-line args and/or environment variables. The fallback logic could look like:

  • Env var?
  • YAML?
  • CL arg?
  • Fail, no repo token provided

Thoughts?

Configuring Xcode project settings for Slather

Running the recommended

$ slather setup path/to/project.xcodeproj

ends up executing this code:

    def slather_setup_for_coverage
      build_configurations.each do |build_configuration|
        build_configuration.build_settings["GCC_INSTRUMENT_PROGRAM_FLOW_ARCS"] = "YES"
        build_configuration.build_settings["GCC_GENERATE_TEST_COVERAGE_FILES"] = "YES"
      end
    end

As currently written, I think that the effects of this (or manually modifying the project file in the same way) is problematic, because we end up turning these 2 flags on even for non-Debug/Test/Coverage builds. From my understanding of these flags, changing them from their default NO value ends up changing the compiled binary (as additional code is injected to perform the measurements). At the very least, this is bad because it's likely inefficient and causes unnecessary overhead. But it's also risky for production code, and a quick search on Google turns up some reports of app crashes and other nastiness in some situations when these flags are enabled.

Now, I don't think this will affect users who integrate the library with CocoaPods, since CocoaPods is generating its own Xcode project (right?), but if you use Carthage or a similar mechanism to build a framework or static library directly from the Xcode project in the repo itself, having these flags on for all build configurations will affect the generated artifacts.

I think these flags should only be set for Debug/Test/Coverage build configurations. The reason I am opening this issue instead of a PR is because I'm not sure the best way to do this...we could test against the build configuration name (looking for "Debug" or similar), or check for a preprocessor define of "DEBUG", or potentially something else.

FWIW, Apple recommends using a separate, new build configuration just for Coverage builds.

Thoughts?

Swift test coverage.

I know that there is no solution yet that allows to generate gcno for swift yet, but I would like to have this issue tracked separately to be alerted when it will be available in Slather. Thanks!

Slather currently has a dependency conflict with CocoaPods v0.38

pod --version                                                                                                Lono@LonodeMacBook-Pro

---------------------------------------------
Error loading the plugin with path `/Library/Ruby/Gems/2.0.0/gems/slather-1.8/lib/cocoapods_plugin.rb`.

Gem::LoadError - Unable to activate slather-1.8, because xcodeproj-0.26.2 conflicts with xcodeproj (~> 0.24.1)
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb:2007:in `raise_if_conflicts'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb:1176:in `activate'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems.rb:186:in `rescue in try_activate'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems.rb:183:in `try_activate'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:132:in `rescue in require'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:144:in `require'
/Library/Ruby/Gems/2.0.0/gems/slather-1.8/lib/cocoapods_plugin.rb:1:in `<top (required)>'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:126:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:126:in `require'
/Library/Ruby/Gems/2.0.0/gems/claide-0.9.1/lib/claide/command/plugin_manager.rb:106:in `safe_require'
/Library/Ruby/Gems/2.0.0/gems/claide-0.9.1/lib/claide/command/plugin_manager.rb:32:in `block in load_plugins'
/Library/Ruby/Gems/2.0.0/gems/claide-0.9.1/lib/claide/command/plugin_manager.rb:31:in `each'
/Library/Ruby/Gems/2.0.0/gems/claide-0.9.1/lib/claide/command/plugin_manager.rb:31:in `load_plugins'
/Library/Ruby/Gems/2.0.0/gems/claide-0.9.1/lib/claide/command.rb:304:in `block in run'
/Library/Ruby/Gems/2.0.0/gems/claide-0.9.1/lib/claide/command.rb:303:in `each'
/Library/Ruby/Gems/2.0.0/gems/claide-0.9.1/lib/claide/command.rb:303:in `run'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.38.0/lib/cocoapods/command.rb:48:in `run'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.38.0/bin/pod:44:in `<top (required)>'
/usr/bin/pod:23:in `load'
/usr/bin/pod:23:in `<main>'
---------------------------------------------

0.38.0

Unable to activate slather-1.8.1, because xcodeproj-0.28.2 conflicts with xcodeproj (~> 0.26.2)

Hi,

It seems that after updating Cocoapods to the latest version breaks slather, because it is depends on an older version of xcodeproj.

If there a way to fix this without downgrading Cocoapods ?

Error loading the plugin with path `/Users/nghimbovschi/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/slather-1.8.1/lib/cocoapods_plugin.rb`.

Gem::ConflictError - Unable to activate slather-1.8.1, because xcodeproj-0.28.2 conflicts with xcodeproj (~> 0.26.2)
/Users/nghimbovschi/.rbenv/versions/2.2.3/lib/ruby/2.2.0/rubygems/specification.rb:2112:in `raise_if_conflicts'
...

get error when executing slather coverage -s myProject.xcodeproj

Slathering...
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1439:in unlink': No such file or directory - AgreementViewController.m.gcov (Errno::ENOENT) from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1439:inblock in remove_file'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1444:in platform_support' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1438:inremove_file'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:785:in remove_file' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:563:inblock in rm'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:562:in each' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:562:inrm'
from /Library/Ruby/Gems/2.0.0/gems/slather-1.3.0/lib/slather/coverage_file.rb:50:in block in gcov_data' from /Library/Ruby/Gems/2.0.0/gems/slather-1.3.0/lib/slather/coverage_file.rb:50:ineach'
from /Library/Ruby/Gems/2.0.0/gems/slather-1.3.0/lib/slather/coverage_file.rb:50:in gcov_data' from /Library/Ruby/Gems/2.0.0/gems/slather-1.3.0/lib/slather/coverage_file.rb:57:incoverage_data'
from /Library/Ruby/Gems/2.0.0/gems/slather-1.3.0/lib/slather/coverage_file.rb:83:in num_lines_tested' from /Library/Ruby/Gems/2.0.0/gems/slather-1.3.0/lib/slather/coverage_file.rb:91:inpercentage_lines_tested'
from /Library/Ruby/Gems/2.0.0/gems/slather-1.3.0/lib/slather/project.rb:57:in each' from /Library/Ruby/Gems/2.0.0/gems/slather-1.3.0/lib/slather/project.rb:57:inmax_by'
from /Library/Ruby/Gems/2.0.0/gems/slather-1.3.0/lib/slather/project.rb:57:in block in dedupe' from /Library/Ruby/Gems/2.0.0/gems/slather-1.3.0/lib/slather/project.rb:57:inmap'
from /Library/Ruby/Gems/2.0.0/gems/slather-1.3.0/lib/slather/project.rb:57:in dedupe' from /Library/Ruby/Gems/2.0.0/gems/slather-1.3.0/lib/slather/project.rb:51:incoverage_files'
from /Library/Ruby/Gems/2.0.0/gems/slather-1.3.0/lib/slather/coverage_service/simple_output.rb:13:in post' from /Library/Ruby/Gems/2.0.0/gems/slather-1.3.0/bin/slather:57:inpost'
from /Library/Ruby/Gems/2.0.0/gems/slather-1.3.0/bin/slather:33:in execute' from /Library/Ruby/Gems/2.0.0/gems/clamp-0.6.5/lib/clamp/command.rb:67:inrun'
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:inrun'
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/clamp-0.6.5/lib/clamp.rb:6:inClamp'
from /Library/Ruby/Gems/2.0.0/gems/slather-1.3.0/bin/slather:6:in <top (required)>' from /usr/local/bin/slather:23:inload'
from /usr/local/bin/slather:23:in `

'

Slather unable to find coverage files?

I've tried to set up two different projects with Slather today (https://github.com/lazerwalker/MTLParseAdapter and https://github.com/intentkit/IntentKit – the former is much smaller/simpler, if you're looking for a test case). Both are failing for the same reason:

/Library/Ruby/Gems/2.0.0/gems/slather-1.7.0/lib/slather/project.rb:49:in `coverage_files': No coverage files found. 
Are you sure your project is setup for generating coverage files? 
Try `slather setup your/project.pbxproj` 
(StandardError)

Both of these are failing both locally and on Travis (e.g. https://travis-ci.org/lazerwalker/MTLParseAdapter/builds/59264653).

Poking around existing issues, it seems that's common if you've manually changed where the gcda files get placed. However, I haven't changed that for either of these projects. It also doesn't appear to be a local system-wide Xcode config issue, as I have other projects with similar setups that will let themselves be Slathered just fine.

Any thoughts?

Code Coverage Data Generation Failed

i've executed slather setup xx.projct when i'm running test with cmd+u it failed:
Code Coverage Data Generation Failed
Unable to retrieve the profile data files from 'iPhone 5s

and the log show
2015-12-14 13:59:28.582 xctest[6447:734168] The bundle “MyTests.xctest” couldn’t be loaded. Try reinstalling the bundle.
2015-12-14 13:59:28.583 xctest[6447:734168

(dlopen(/Users/wx/Library/Developer/Xcode/DerivedData/My-akiykixzlljhyegfebcgflamfzgb/Build/Intermediates/CodeCoverage/My/Products/Debug-iphonesimulator/MyTests.xctest/MyTests, 265): Symbol not found: OBJC_CLASS$_AgreementViewController
Referenced from: /Users/wx/Library/Developer/Xcode/DerivedData/My-akiykixzlljhyegfebcgflamfzgb/Build/Intermediates/CodeCoverage/My/Products/Debug-iphonesimulator/MyTests.xctest/MyTests
Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Agents/xctest
in /Users/wx/Library/Developer/Xcode/DerivedData/My-akiykixzlljhyegfebcgflamfzgb/Build/Intermediates/CodeCoverage/My/Products/Debug-iphonesimulator/MyTests.xctest/MyTests)

Program ended with exit code: 83

Slather setup failing locally

Looks like slather setup project is working but now when I try to run slather coverage I'm being told

No coverage files found. Are you sure your project is setup for generating coverage files

Coveralls reporting 0% coverage with Slather/Travis integration

So this is the first time I've used Slather + Coveralls, and I'm running into an issue as described here: intuit/LocationManager#37 (comment)

Running Slather locally on the Xcode project works fine:

$ slather coverage -s LocationManagerExample/LocationManagerExample.xcodeproj/
Slathering...
Source/INTULocationManager.m: 180 of 240 lines (75.00%)
Source/INTULocationRequest.m: 60 of 73 lines (82.19%)
Test Coverage: 76.68%
Slathered

However, something is failing when this runs on Travis, and as a result Coveralls shows 0% coverage (although Coveralls does show the correct source files). Here's the output from a Travis build: https://travis-ci.org/intuit/LocationManager/builds/59321046

Any idea if this a Slather or Coveralls issue and what I need to do to get this working?

Support for multiple output

It would be great if I could export multiple output with 1 line of command.

slather coverage -x --html --output-directory MyTests

Slather crashes when source files are empty

Something I have noticed when running slather in the wild.
If you have an empty source file (or a file with the code commented out) you get a lot of errors like the one below.
I think we do not check defensively enough for nil values on the coverage data when calculating line and branch coverage data:

/Users/xxxxx/.rvm/gems/ruby-2.0.0-p247/gems/slather-1.5.0/lib/slather/coverage_file.rb:68:in `cleaned_gcov_data': undefined method `gsub' for nil:NilClass (NoMethodError)
    from /Users/xxxxx/.rvm/gems/ruby-2.0.0-p247/gems/slather-1.5.0/lib/slather/coverage_file.rb:56:in `line_coverage_data'
    from /Users/xxxxx/.rvm/gems/ruby-2.0.0-p247/gems/slather-1.5.0/lib/slather/coverage_file.rb:91:in `num_lines_testable'
    from /Users/xxxxx/.rvm/gems/ruby-2.0.0-p247/gems/slather-1.5.0/lib/slather/coverage_file.rb:99:in `percentage_lines_tested'
    from /Users/xxxxx/.rvm/gems/ruby-2.0.0-p247/gems/slather-1.5.0/lib/slather/project.rb:57:in `each'
    from /Users/xxxxx/.rvm/gems/ruby-2.0.0-p247/gems/slather-1.5.0/lib/slather/project.rb:57:in `max_by'
    from /Users/xxxxx/.rvm/gems/ruby-2.0.0-p247/gems/slather-1.5.0/lib/slather/project.rb:57:in `block in dedupe'
    from /Users/xxxxx/.rvm/gems/ruby-2.0.0-p247/gems/slather-1.5.0/lib/slather/project.rb:57:in `map'
    from /Users/xxxxx/.rvm/gems/ruby-2.0.0-p247/gems/slather-1.5.0/lib/slather/project.rb:57:in `dedupe'
    from /Users/xxxxx/.rvm/gems/ruby-2.0.0-p247/gems/slather-1.5.0/lib/slather/project.rb:51:in `coverage_files'
    from /Users/xxxxx/.rvm/gems/ruby-2.0.0-p247/gems/slather-1.5.0/lib/slather/coverage_service/simple_output.rb:13:in `post'
    from /Users/xxxxx/.rvm/gems/ruby-2.0.0-p247/gems/slather-1.5.0/bin/slather:58:in `post'
    from /Users/xxxxx/.rvm/gems/ruby-2.0.0-p247/gems/slather-1.5.0/bin/slather:34:in `execute'
    from /Users/xxxxx/.rvm/gems/ruby-2.0.0-p247/gems/clamp-0.6.3/lib/clamp/command.rb:67:in `run'
    from /Users/xxxxx/.rvm/gems/ruby-2.0.0-p247/gems/clamp-0.6.3/lib/clamp/subcommand/execution.rb:11:in `execute'
    from /Users/xxxxx/.rvm/gems/ruby-2.0.0-p247/gems/clamp-0.6.3/lib/clamp/command.rb:67:in `run'
    from /Users/xxxxx/.rvm/gems/ruby-2.0.0-p247/gems/clamp-0.6.3/lib/clamp/command.rb:125:in `run'
    from /Users/xxxxx/.rvm/gems/ruby-2.0.0-p247/gems/clamp-0.6.3/lib/clamp.rb:6:in `Clamp'
    from /Users/xxxxx/.rvm/gems/ruby-2.0.0-p247/gems/slather-1.5.0/bin/slather:6:in `<top (required)>'
    from /Users/xxxxx/.rvm/gems/ruby-2.0.0-p247/bin/slather:23:in `load'
    from /Users/xxxxx/.rvm/gems/ruby-2.0.0-p247/bin/slather:23:in `<main>'
    from /Users/xxxxx/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `eval'
    from /Users/xxxxx/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `<main>'

Project Setup fails, .pbxproj file breaks

I'm currently looking into slather as our tool of choice to measure code coverage in connection with coveralls.io

When I initially tried to setup slather as mentioned in the README.txt through
slather setup Project.xcodeproj
my whole .pbxproj file got rewritten (as what the diff showed me) due to different ways of formatting the file.

My next step, was using
slather coverage -s Project.xcodeproj
to measure my code coverage. Unfortunately, this is where everything breaks and slather starts to throw the stack trace at me.

The error message looks like this:

Slathering...
/Users/florian/.rvm/gems/ruby-2.2.0/gems/slather-1.5.4/lib/slather/project.rb:49:in `coverage_files': No coverage files found. Are you sure your project is setup for generating coverage files? Try `slather setup your/project.pbxproj` (StandardError)
    from /Users/florian/.rvm/gems/ruby-2.2.0/gems/slather-1.5.4/lib/slather/coverage_service/simple_output.rb:13:in `post'
    from /Users/florian/.rvm/gems/ruby-2.2.0/gems/slather-1.5.4/bin/slather:64:in `post'
    from /Users/florian/.rvm/gems/ruby-2.2.0/gems/slather-1.5.4/bin/slather:36:in `execute'
    from /Users/florian/.rvm/gems/ruby-2.2.0/gems/clamp-0.6.3/lib/clamp/command.rb:67:in `run'
    from /Users/florian/.rvm/gems/ruby-2.2.0/gems/clamp-0.6.3/lib/clamp/subcommand/execution.rb:11:in `execute'
    from /Users/florian/.rvm/gems/ruby-2.2.0/gems/clamp-0.6.3/lib/clamp/command.rb:67:in `run'
    from /Users/florian/.rvm/gems/ruby-2.2.0/gems/clamp-0.6.3/lib/clamp/command.rb:125:in `run'
    from /Users/florian/.rvm/gems/ruby-2.2.0/gems/clamp-0.6.3/lib/clamp.rb:6:in `Clamp'
    from /Users/florian/.rvm/gems/ruby-2.2.0/gems/slather-1.5.4/bin/slather:6:in `<top (required)>'
    from /Users/florian/.rvm/gems/ruby-2.2.0/bin/slather:23:in `load'
    from /Users/florian/.rvm/gems/ruby-2.2.0/bin/slather:23:in `<main>'
    from /Users/florian/.rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in `eval'
    from /Users/florian/.rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in `<main>'

After investigating into this for several hours, I found another "example" project which is using Slather + Coveralls.io and their slather support is broken as well.
The project I was looking into is the XNGAPIClient, which had their last successful measurement in mid December (see this build Travis CI Coveralls.io).

As it's definitely not the difference between XCode 6.1 and XCode 6.1.1 (tried that), I tried to add these flags manually and slather started to work.

So afaik, the setup function of slather is not working right now and should be fixed ASAP as slather is more or less not useable in comparison with Travis CI (only with a customised setup).

pod install automatically sets coverage on Pods.xcodeproj

Given slather is installed, when you run pod install, then the targets in Pods.xcodeproj all have
Instrument Program Flow and Generate Test Coverage Files set to Yes, which makes the build fail for a project that doesn't have those flags set to Yes with the following:

Undefined symbols for architecture x86_64:
  "_llvm_gcda_emit_arcs", referenced from:
      ___llvm_gcov_writeout in libPods-SlatherTest-ObjectiveSugar.a(NSArray+ObjectiveSugar.o)
      ___llvm_gcov_writeout in libPods-SlatherTest-ObjectiveSugar.a(NSDictionary+ObjectiveSugar.o)
      ___llvm_gcov_writeout in libPods-SlatherTest-ObjectiveSugar.a(NSMutableArray+ObjectiveSugar.o)
      ___llvm_gcov_writeout in libPods-SlatherTest-ObjectiveSugar.a(NSNumber+ObjectiveSugar.o)
      ___llvm_gcov_writeout in libPods-SlatherTest-ObjectiveSugar.a(NSSet+ObjectiveSugar.o)
      ___llvm_gcov_writeout in libPods-SlatherTest-ObjectiveSugar.a(NSString+ObjectiveSugar.o)
  "_llvm_gcda_emit_function", referenced from:
      ___llvm_gcov_writeout in libPods-SlatherTest-ObjectiveSugar.a(NSArray+ObjectiveSugar.o)
      ___llvm_gcov_writeout in libPods-SlatherTest-ObjectiveSugar.a(NSDictionary+ObjectiveSugar.o)
      ___llvm_gcov_writeout in libPods-SlatherTest-ObjectiveSugar.a(NSMutableArray+ObjectiveSugar.o)
      ___llvm_gcov_writeout in libPods-SlatherTest-ObjectiveSugar.a(NSNumber+ObjectiveSugar.o)
      ___llvm_gcov_writeout in libPods-SlatherTest-ObjectiveSugar.a(NSSet+ObjectiveSugar.o)
      ___llvm_gcov_writeout in libPods-SlatherTest-ObjectiveSugar.a(NSString+ObjectiveSugar.o)
  "_llvm_gcda_end_file", referenced from:
      ___llvm_gcov_writeout in libPods-SlatherTest-ObjectiveSugar.a(Pods-SlatherTest-ObjectiveSugar-dummy.o)
      ___llvm_gcov_writeout in libPods-SlatherTest-ObjectiveSugar.a(NSArray+ObjectiveSugar.o)
      ___llvm_gcov_writeout in libPods-SlatherTest-ObjectiveSugar.a(NSDictionary+ObjectiveSugar.o)
      ___llvm_gcov_writeout in libPods-SlatherTest-ObjectiveSugar.a(NSMutableArray+ObjectiveSugar.o)
      ___llvm_gcov_writeout in libPods-SlatherTest-ObjectiveSugar.a(NSNumber+ObjectiveSugar.o)
      ___llvm_gcov_writeout in libPods-SlatherTest-ObjectiveSugar.a(NSSet+ObjectiveSugar.o)
      ___llvm_gcov_writeout in libPods-SlatherTest-ObjectiveSugar.a(NSString+ObjectiveSugar.o)
      ...
  "_llvm_gcda_start_file", referenced from:
      ___llvm_gcov_writeout in libPods-SlatherTest-ObjectiveSugar.a(Pods-SlatherTest-ObjectiveSugar-dummy.o)
      ___llvm_gcov_writeout in libPods-SlatherTest-ObjectiveSugar.a(NSArray+ObjectiveSugar.o)
      ___llvm_gcov_writeout in libPods-SlatherTest-ObjectiveSugar.a(NSDictionary+ObjectiveSugar.o)
      ___llvm_gcov_writeout in libPods-SlatherTest-ObjectiveSugar.a(NSMutableArray+ObjectiveSugar.o)
      ___llvm_gcov_writeout in libPods-SlatherTest-ObjectiveSugar.a(NSNumber+ObjectiveSugar.o)
      ___llvm_gcov_writeout in libPods-SlatherTest-ObjectiveSugar.a(NSSet+ObjectiveSugar.o)
      ___llvm_gcov_writeout in libPods-SlatherTest-ObjectiveSugar.a(NSString+ObjectiveSugar.o)
      ...
  "_llvm_gcda_summary_info", referenced from:
      ___llvm_gcov_writeout in libPods-SlatherTest-ObjectiveSugar.a(Pods-SlatherTest-ObjectiveSugar-dummy.o)
      ___llvm_gcov_writeout in libPods-SlatherTest-ObjectiveSugar.a(NSArray+ObjectiveSugar.o)
      ___llvm_gcov_writeout in libPods-SlatherTest-ObjectiveSugar.a(NSDictionary+ObjectiveSugar.o)
      ___llvm_gcov_writeout in libPods-SlatherTest-ObjectiveSugar.a(NSMutableArray+ObjectiveSugar.o)
      ___llvm_gcov_writeout in libPods-SlatherTest-ObjectiveSugar.a(NSNumber+ObjectiveSugar.o)
      ___llvm_gcov_writeout in libPods-SlatherTest-ObjectiveSugar.a(NSSet+ObjectiveSugar.o)
      ___llvm_gcov_writeout in libPods-SlatherTest-ObjectiveSugar.a(NSString+ObjectiveSugar.o)
      ...
  "_llvm_gcov_init", referenced from:
      ___llvm_gcov_init in libPods-SlatherTest-ObjectiveSugar.a(Pods-SlatherTest-ObjectiveSugar-dummy.o)
      ___llvm_gcov_init in libPods-SlatherTest-ObjectiveSugar.a(NSArray+ObjectiveSugar.o)
      ___llvm_gcov_init in libPods-SlatherTest-ObjectiveSugar.a(NSDictionary+ObjectiveSugar.o)
      ___llvm_gcov_init in libPods-SlatherTest-ObjectiveSugar.a(NSMutableArray+ObjectiveSugar.o)
      ___llvm_gcov_init in libPods-SlatherTest-ObjectiveSugar.a(NSNumber+ObjectiveSugar.o)
      ___llvm_gcov_init in libPods-SlatherTest-ObjectiveSugar.a(NSSet+ObjectiveSugar.o)
      ___llvm_gcov_init in libPods-SlatherTest-ObjectiveSugar.a(NSString+ObjectiveSugar.o)
      ...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I think that rather than forcing those flags to be Yes by default on any project, they should only be set once you run slather setup against your project.

Cobertura Report for CI Integration

Hello folks,

I am currently looking for coverage reports which can be integrated in a classical Jenkins Continuous Integration environment.

Cobertura is very popular there so I thought I'd write a coverage service to generate coverage reports in Cobertura XML format. Since xctool is able to generate JUnit reports a Cobertura XML coverage service for slather would be a good complement.

It is still missing branch coverage calculation and specs but if you like you can take a look at it here:

https://github.com/tarbrain/slather/tree/feature/cobertura_reporter

Cheers
Julian

Install on OS X

How do I install Slather onto my Mac?

I tried sudo gem install slather, but it gets so far and crashes.

Building native extensions. This could take a while...
ERROR: Error installing slather:
ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb

checking if the C compiler accepts ... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
--help
--clean
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:434:in try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:549:inblock in try_compile'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:500:in with_werror' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:549:intry_compile'
from extconf.rb:80:in nokogiri_try_compile' from extconf.rb:87:inblock in add_cflags'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:599:in with_cflags' from extconf.rb:86:inadd_cflags'
from extconf.rb:337:in `

'

Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.6.4 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.6.4/ext/nokogiri/gem_make.out

Is there a way to specify the location of DerivedData?

Hi,

Considering that I choosed to use relative location of DerivedData to prevent interferences of compilation through different projects, I'm not seeing somewhere where I could tell to use a specific DerivedDara location for Slather to find the gcov files.

Am I missing something or the path to the DerivedData directory is static?

Export to HTML

Should slather have HTML export?

gcovr can produce an ugly static html report, would be great if we could generate a pretty modern html report with some javascript to support filtering, reorder, etc within the page. Only restriction would be it needs to be able to run as a file:/// url (no cross-origin)

Error when trying to generate a HTML report

Hello Slather team,
I am new to Slather and am trying to set it up for coverage report.
I am using the following branch:
gem 'slather', :git => "https://github.com/mattdelves/slather.git", :branch => "feature-profdata"

I am trying to generate an Html report for my iOS project and used the following command:
"slather coverage --html --show"

and get the following error:

//.rvm/gems/ruby-2.1.0/bundler/gems/slather-d09ce4f5d592/lib/slather/coverage_file.rb:50:in gcov_data': undefined methodbasename' for nil:NilClass (NoMethodError)
from //.rvm/gems/ruby-2.1.0/bundler/gems/slather-d09ce4f5d592/lib/slather/coverage_file.rb:72:in cleaned_gcov_data' from //.rvm/gems/ruby-2.1.0/bundler/gems/slather-d09ce4f5d592/lib/slather/coverage_file.rb:81:inline_coverage_data'
from //.rvm/gems/ruby-2.1.0/bundler/gems/slather-d09ce4f5d592/lib/slather/coverage_info.rb:5:in num_lines_tested' from //.rvm/gems/ruby-2.1.0/bundler/gems/slather-d09ce4f5d592/lib/slather/coverage_service/html_output.rb:62:inblock in create_index_html'
from //.rvm/gems/ruby-2.1.0/bundler/gems/slather-d09ce4f5d592/lib/slather/coverage_service/html_output.rb:61:in each' from //.rvm/gems/ruby-2.1.0/bundler/gems/slather-d09ce4f5d592/lib/slather/coverage_service/html_output.rb:61:increate_index_html'
from //.rvm/gems/ruby-2.1.0/bundler/gems/slather-d09ce4f5d592/lib/slather/coverage_service/html_output.rb:41:in create_html_reports' from //.rvm/gems/ruby-2.1.0/bundler/gems/slather-d09ce4f5d592/lib/slather/coverage_service/html_output.rb:19:inpost'
from //.rvm/gems/ruby-2.1.0/bundler/gems/slather-d09ce4f5d592/bin/slather:80:in post' from //.rvm/gems/ruby-2.1.0/bundler/gems/slather-d09ce4f5d592/bin/slather:46:inexecute'
from //.rvm/gems/ruby-2.1.0/gems/clamp-0.6.5/lib/clamp/command.rb:67:in run' from //.rvm/gems/ruby-2.1.0/gems/clamp-0.6.5/lib/clamp/subcommand/execution.rb:11:inexecute'
from //.rvm/gems/ruby-2.1.0/gems/clamp-0.6.5/lib/clamp/command.rb:67:in run' from //.rvm/gems/ruby-2.1.0/gems/clamp-0.6.5/lib/clamp/command.rb:132:inrun'
from //.rvm/gems/ruby-2.1.0/gems/clamp-0.6.5/lib/clamp.rb:6:in Clamp' from //.rvm/gems/ruby-2.1.0/bundler/gems/slather-d09ce4f5d592/bin/slather:6:in<top (required)>'
from //.rvm/gems/ruby-2.1.0/bin/slather:23:in load' from //.rvm/gems/ruby-2.1.0/bin/slather:23:in

'
from //.rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks:15:in eval' from //.rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks:15:in'

Can some one please advice on what i am doing wrong?

Thank you

Wrong gem releases

Hi there,

I've tried to use cobertura_xml coverage service but I've got the following error:
coverage_service=:'' is not a valid coverage service. Try 'terminal' or 'coveralls' (ArgumentError)

I get this same message even if install 1.8.2 specifically. That message was in 1.4.0 last time. So it seems that wrong code downloaded when it's installed via RubyGems.

Another symptom: gemspec of 1.8.2 says that it depends on xcodeproj 0.28.0 but on RubyGems.org it is xcodeproj 0.17. (which was the dependency in slather 1.4.0)

Could you look after it? Thanks.

CircleCI =/> Coveralls

Under slather 1.8, iOS projects built on CircleCI with a coverage_service of coveralls fail to post coverage results to Coveralls. See this build, which seems to slather properly (Slathering... Slathered) but never posts to Coveralls.

CircleCI => Coveralls worked properly in previous releases of slather, as seen in this build from today which is pinned to slather 1.7.1.

Posting this issue mostly as a reminder to myself to look into this :)

Slather currently has a dependency conflict with CocoaPods v0.35

$ pod install
Error loading the plugin with path `/Users/travis/.rvm/gems/ruby-2.0.0-p481/gems/slather-1.5.2/lib/cocoapods_plugin.rb`.
Gem::LoadError - Unable to activate slather-1.5.2, because xcodeproj-0.20.2 conflicts with xcodeproj (~> 0.19.2)
/Users/travis/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/site_ruby/2.0.0/rubygems/specification.rb:2064:in `raise_if_conflicts'
/Users/travis/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/site_ruby/2.0.0/rubygems/specification.rb:1262:in `activate'
/Users/travis/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/site_ruby/2.0.0/rubygems.rb:196:in `rescue in try_activate'
/Users/travis/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/site_ruby/2.0.0/rubygems.rb:193:in `try_activate'
/Users/travis/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:132:in `rescue in require'
/Users/travis/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:144:in `require'
/Users/travis/.rvm/gems/ruby-2.0.0-p481/gems/slather-1.5.2/lib/cocoapods_plugin.rb:1:in `<top (required)>'
/Users/travis/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/Users/travis/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/Users/travis/.rvm/gems/ruby-2.0.0-p481/gems/claide-0.7.0/lib/claide/command/plugins_helper.rb:104:in `safe_require'
/Users/travis/.rvm/gems/ruby-2.0.0-p481/gems/claide-0.7.0/lib/claide/command/plugins_helper.rb:32:in `block in load_plugins'
/Users/travis/.rvm/gems/ruby-2.0.0-p481/gems/claide-0.7.0/lib/claide/command/plugins_helper.rb:31:in `each'
/Users/travis/.rvm/gems/ruby-2.0.0-p481/gems/claide-0.7.0/lib/claide/command/plugins_helper.rb:31:in `load_plugins'
/Users/travis/.rvm/gems/ruby-2.0.0-p481/gems/claide-0.7.0/lib/claide/command.rb:265:in `run'
/Users/travis/.rvm/gems/ruby-2.0.0-p481/gems/cocoapods-0.35.0/lib/cocoapods/command.rb:45:in `run'
/Users/travis/.rvm/gems/ruby-2.0.0-p481/gems/cocoapods-0.35.0/bin/pod:43:in `<top (required)>'
/Users/travis/.rvm/gems/ruby-2.0.0-p481/bin/pod:23:in `load'
/Users/travis/.rvm/gems/ruby-2.0.0-p481/bin/pod:23:in `<main>'
/Users/travis/.rvm/gems/ruby-2.0.0-p481/bin/ruby_executable_hooks:15:in `eval'
/Users/travis/.rvm/gems/ruby-2.0.0-p481/bin/ruby_executable_hooks:15:

Remove xcodeproj dependency?

As far as I can tell, it's only used to add those two build options. It kills me to see it take forever to gem install xcodeproj, activesupport, etc on CI.

Maybe, slather-core that's just what you need on CI and keep xcodeproj in regular slather. Just a thought.

Have it work for projects with duplicate gcno files

It's possible to set up a project such that there are duplicate gcno files produced. VENTokenField use to have a project org issue where this happened, where 1 copy would have the correct test coverage and the other would have 0% coverage.

Friendly error messages

The error handling could be changed so this doesn't output a Ruby backtrace to the user.

$ slather coverage -s CGFloatTypeTests/CGFloatType.xcodeproj
/Users/kylef/gems/gems/slather-1.0.1/lib/slather/project.rb:34:in `coverage_files': No coverage files found. Are you sure your project is setup for generating coverage files? Try `slather setup your/project.pbxproj` (StandardError)
    from /Users/kylef/gems/gems/slather-1.0.1/lib/slather/coverage_service/simple_output.rb:13:in `post'
    from /Users/kylef/gems/gems/slather-1.0.1/bin/slather:50:in `post'
    from /Users/kylef/gems/gems/slather-1.0.1/bin/slather:30:in `execute'
    from /Users/kylef/gems/gems/clamp-0.6.3/lib/clamp/command.rb:67:in `run'
    from /Users/kylef/gems/gems/clamp-0.6.3/lib/clamp/subcommand/execution.rb:11:in `execute'
    from /Users/kylef/gems/gems/clamp-0.6.3/lib/clamp/command.rb:67:in `run'
    from /Users/kylef/gems/gems/clamp-0.6.3/lib/clamp/command.rb:125:in `run'
    from /Users/kylef/gems/gems/clamp-0.6.3/lib/clamp.rb:6:in `Clamp'
    from /Users/kylef/gems/gems/slather-1.0.1/bin/slather:6:in `<top (required)>'
    from /Users/kylef/gems/bin/slather:23:in `load'
    from /Users/kylef/gems/bin/slather:23:in `<main>'
$ slather
Slathering...
/Users/kylef/gems/gems/slather-1.0.1/lib/slather/coverage_service/coveralls.rb:24:in `coveralls_coverage_data': Environment variable `TRAVIS_JOB_ID` not set. Is this running on a travis build? (StandardError)
    from /Users/kylef/gems/gems/slather-1.0.1/lib/slather/coverage_service/coveralls.rb:35:in `post'
    from /Users/kylef/gems/gems/slather-1.0.1/bin/slather:50:in `post'
    from /Users/kylef/gems/gems/slather-1.0.1/bin/slather:30:in `execute'
    from /Users/kylef/gems/gems/clamp-0.6.3/lib/clamp/command.rb:67:in `run'
    from /Users/kylef/gems/gems/clamp-0.6.3/lib/clamp/subcommand/execution.rb:11:in `execute'
    from /Users/kylef/gems/gems/clamp-0.6.3/lib/clamp/command.rb:67:in `run'
    from /Users/kylef/gems/gems/clamp-0.6.3/lib/clamp/command.rb:125:in `run'
    from /Users/kylef/gems/gems/clamp-0.6.3/lib/clamp.rb:6:in `Clamp'
    from /Users/kylef/gems/gems/slather-1.0.1/bin/slather:6:in `<top (required)>'
    from /Users/kylef/gems/bin/slather:23:in `load'
    from /Users/kylef/gems/bin/slather:23:in `<main>'

Would be nice to be able to specify a path where to put Cobertura reports

Thanks a lot for adding Cobertura support recently! 👍

It would be useful to me if I cam specify a place where cobertura report should be saved. I.e. build/reports/coverage.xml instead of cobertura.xml. Or can be even more useful if slather can return the data into output stream instead of collection it into one variable and then putting it into file. So it will allow to do something like slather coverage -x > build/reports/covearage.xml. Or, if needed, slather coverage -x | tee build/reports/covearage.xml so its output will be returned into console as well.

[Question] Slather shows error -No object file for requested architecture

I am trying to run slather on my Xcode 7 project slather, but I get the error "Failed to load coverage: No object file for requested architecture".
Here is the command I am running (as per the instructions in http://mgrebenets.github.io/mobile%20ci/2015/09/21/code-coverage-for-ios-xcode-7/)

bundle exec slather coverage --input-format profdata -s --ignore "../**/*/Xcode*" --output-directory slather-report --scheme MyApp MyApp.xcodeproj

Note 1: The DerivedData folder contains these two files - Coverage.profdata and ProfileData/MyApp-39997.profdata
Note 2: my project uses Pods and hence has a corresponding xcworkspace. Does this affect the use of slather?

Support Codecov

Hey friends,

I'm the founder of Codecov and would like to accept uploads from Slather. I simply need an example output file I can parse into our format on Codecov.

Thank you for your time!

More frictionless configuration

The config right now is pretty annoying -- you have to make .slather.yml, modify .travis.yml, and also potentially add stuff to the Podfile. It'd be nice to use something like highline to walk the user through things by asking them questions and then automatically creating/modifying files.

Add --verbose option

Suggestion from @marklarr:

  • Log when we've successfully configured pods for slather
  • Log each GCNO file that is ignored (ones for files that aren't your source files, and also duplicate ones.)
  • Log each GCNO file that is processed, along with its
  • created_at timestamp
  • modified_at timestamp
  • Contents? Seems too noisy... but it'd be nice to at least see a couple.
  • Add some sort of #inspect method to Slather::CoverageFile class, and print out this as well.
  • Add coverage_service specific logging to each of the services. For example, for coveralls, print out the JSON blob that it'll send to coveralls, and the response from coveralls after it has been posted.

Ruby Crash with Xcode 6

I'm getting this crash when running slather:

Slathering...
/Users/ksmiley/.rbenv/versions/2.1.3/lib/ruby/2.1.0/fileutils.rb:1454:in `unlink': No such file or directory @ unlink_internal - AccountsViewController.m.gcov (Errno::ENOENT)
        from /Users/ksmiley/.rbenv/versions/2.1.3/lib/ruby/2.1.0/fileutils.rb:1454:in `block in remove_file'
        from /Users/ksmiley/.rbenv/versions/2.1.3/lib/ruby/2.1.0/fileutils.rb:1459:in `platform_support'
        from /Users/ksmiley/.rbenv/versions/2.1.3/lib/ruby/2.1.0/fileutils.rb:1453:in `remove_file'
        from /Users/ksmiley/.rbenv/versions/2.1.3/lib/ruby/2.1.0/fileutils.rb:791:in `remove_file'
        from /Users/ksmiley/.rbenv/versions/2.1.3/lib/ruby/2.1.0/fileutils.rb:569:in `block in rm'
        from /Users/ksmiley/.rbenv/versions/2.1.3/lib/ruby/2.1.0/fileutils.rb:568:in `each'
        from /Users/ksmiley/.rbenv/versions/2.1.3/lib/ruby/2.1.0/fileutils.rb:568:in `rm'
        from /Users/ksmiley/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/slather-1.3.0/lib/slather/coverage_file.rb:50:in `block in gcov_data'
        from /Users/ksmiley/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/slather-1.3.0/lib/slather/coverage_file.rb:50:in `each'
        from /Users/ksmiley/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/slather-1.3.0/lib/slather/coverage_file.rb:50:in `gcov_data'
        from /Users/ksmiley/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/slather-1.3.0/lib/slather/coverage_file.rb:57:in `coverage_data'
        from /Users/ksmiley/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/slather-1.3.0/lib/slather/coverage_file.rb:83:in `num_lines_tested'
        from /Users/ksmiley/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/slather-1.3.0/lib/slather/coverage_file.rb:91:in `percentage_lines_tested'
        from /Users/ksmiley/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/slather-1.3.0/lib/slather/project.rb:57:in `each'
        from /Users/ksmiley/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/slather-1.3.0/lib/slather/project.rb:57:in `max_by'
        from /Users/ksmiley/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/slather-1.3.0/lib/slather/project.rb:57:in `block in dedupe'
        from /Users/ksmiley/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/slather-1.3.0/lib/slather/project.rb:57:in `map'
        from /Users/ksmiley/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/slather-1.3.0/lib/slather/project.rb:57:in `dedupe'
        from /Users/ksmiley/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/slather-1.3.0/lib/slather/project.rb:51:in `coverage_files'
        from /Users/ksmiley/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/slather-1.3.0/lib/slather/coverage_service/simple_output.rb:13:in `post'
        from /Users/ksmiley/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/slather-1.3.0/bin/slather:57:in `post'
        from /Users/ksmiley/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/slather-1.3.0/bin/slather:33:in `execute'
        from /Users/ksmiley/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/clamp-0.6.3/lib/clamp/command.rb:67:in `run'
        from /Users/ksmiley/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/clamp-0.6.3/lib/clamp/subcommand/execution.rb:11:in `execute'
        from /Users/ksmiley/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/clamp-0.6.3/lib/clamp/command.rb:67:in `run'
        from /Users/ksmiley/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/clamp-0.6.3/lib/clamp/command.rb:125:in `run'
        from /Users/ksmiley/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/clamp-0.6.3/lib/clamp.rb:6:in `Clamp'
        from /Users/ksmiley/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/slather-1.3.0/bin/slather:6:in `<top (required)>'
        from /Users/ksmiley/.rbenv/versions/2.1.3/bin/slather:23:in `load'
        from /Users/ksmiley/.rbenv/versions/2.1.3/bin/slather:23:in `<main>'
        from /Users/ksmiley/.rbenv/versions/2.1.3/bin/ruby_executable_hooks:15:in `eval'
        from /Users/ksmiley/.rbenv/versions/2.1.3/bin/ruby_executable_hooks:15:in `<main>'

I'm seeing this with ruby 2.1.3 and 1.9.3

context

Expose a CocoaPods plugin

Once CocoaPods/CocoaPods#1755 is merged, we can use the post-install hook to enable the settings and user's wont need to add the following the their Podfile's:

begin
  require 'slather'
  Slather.prepare_pods(self)
rescue LoadError
  puts 'Slather has been disabled (not installed).'
end

Current state of development

Hello slather developers,

I have noticed that development activity on this project has slowed down over the last four months. Could anyone of you give me an update on how the project is currently maintained? There are open issues related to Xcode 7 and the changes that have been introduced with it, coverage formats in particular.

Since many of us are using slather not only on their pet projects but also on the job we need development in the flow especially when working actively on iOS 9 / watchOS / tvOS projects.

I would love to hear from you.

Regards
tarbrain

CocoaPods plugin should be opt-in or at least opt-out

I don't think installing slather should automatically screw with all pod installs without there being any way to turn it off save for deleting the plugin from the Gem. I don't think it is a safe assumption that everyone who uses slather and CocoaPods wants it in all projects.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.