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

Add code coverage #1193

Merged
merged 1 commit into from
Jan 24, 2017
Merged

Add code coverage #1193

merged 1 commit into from
Jan 24, 2017

Conversation

ananyo2012
Copy link
Member

@ananyo2012 ananyo2012 commented Jan 19, 2017

Closes #1191

Make sure these boxes are checked before your pull request is ready to be reviewed and merged. Thanks!

  • all tests pass -- rake test:all
  • code is in uniquely-named feature branch, and has been rebased on top of latest master (especially if you've been asked to make additional changes)
  • pull request is descriptively named with #number reference back to original issue
  • if possible, multiple commits squashed if they're smaller changes
  • reviewed/confirmed/tested by another contributor or maintainer
  • schema.rb.example has been updated if any database migrations were added

Please be sure you've reviewed our contribution guidelines at https://publiclab.org/wiki/contributing-to-public-lab-software

We have a loose schedule of reviewing and pulling in changes every Tuesday and Friday, and publishing changes on Fridays. Please alert developers on plots-dev@googlegroups.com when your request is ready or if you need assistance.

Thanks!

@jywarren
Copy link
Member

Wow, this is pretty cool, Ananyo. Will it outright reject poorly-formatted code, or will it provide helpful feedback when run (and is there any way we can ensure it will)? Thanks!

@ananyo2012
Copy link
Member Author

Well if we set a benchmark to the coverage then it will fail the build if test coverage falls below that. Otherwise it helps to show useful information like test coverage and linting errors, security warnings in the coverage link. I will add the badges in readme. I am using coveralls for the test coverage and code climate for other useful information.

@ananyo2012 ananyo2012 force-pushed the coverage branch 2 times, most recently from b1145eb to 64deeec Compare January 20, 2017 03:40
@jywarren
Copy link
Member

So for now it just shows helpful notes on formatting, but we haven't yet set benchmarks?

So, i see this:

Started
................................................................................
............................................................
Finished in 2.887479313 seconds.
--------------------------------------------------------------------------------
140 tests, 425 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
0% passed
--------------------------------------------------------------------------------
48.49 tests/s, 147.19 assertions/s
[Coveralls] Outside the CI environment, not sending data.
DEPRECATION WARNING: [paperclip] [deprecation] Rails 3.2 and 4.1 are unsupported as of Rails 5 release. Please upgrade to Rails 4.2 before upgrading paperclip. (called from <class:Image> at /app/app/models/image.rb:12)
DEPRECATION WARNING: [paperclip] [deprecation] Rails 3.2 and 4.1 are unsupported as of Rails 5 release. Please upgrade to Rails 4.2 before upgrading paperclip. (called from <class:User> at /app/app/models/user.rb:21)
Loaded suite /usr/local/lib/ruby/gems/2.1.0/gems/rake-10.5.0/lib/rake/rake_test_loader
Started
................................................................................
................................................................................
................................................................................
.............................................
Finished in 27.312740108 seconds.
--------------------------------------------------------------------------------
285 tests, 706 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
0% passed
--------------------------------------------------------------------------------
10.43 tests/s, 25.85 assertions/s
[Coveralls] Outside the CI environment, not sending data.
DEPRECATION WARNING: [paperclip] [deprecation] Rails 3.2 and 4.1 are unsupported as of Rails 5 release. Please upgrade to Rails 4.2 before upgrading paperclip. (called from <class:Image> at /app/app/models/image.rb:12)
DEPRECATION WARNING: [paperclip] [deprecation] Rails 3.2 and 4.1 are unsupported as of Rails 5 release. Please upgrade to Rails 4.2 before upgrading paperclip. (called from <class:User> at /app/app/models/user.rb:21)
Loaded suite /usr/local/lib/ruby/gems/2.1.0/gems/rake-10.5.0/lib/rake/rake_test_loader
Started
......................................................................
Finished in 34.824472288 seconds.
--------------------------------------------------------------------------------
70 tests, 204 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
0% passed
--------------------------------------------------------------------------------
2.01 tests/s, 5.86 assertions/s
[Coveralls] Outside the CI environment, not sending data.

(here)

Does that mean they didn't run in Travis?

@ananyo2012
Copy link
Member Author

ananyo2012 commented Jan 20, 2017

This is not ready yet. The CI isn't sending the coverage data as you can see in the line

[Coveralls] Outside the CI environment, not sending data.

Looking for possible solutions in these links: lemurheavy/coveralls-public#190, lemurheavy/coveralls-public#782

@ananyo2012 ananyo2012 force-pushed the coverage branch 14 times, most recently from 454eef7 to 24138d5 Compare January 23, 2017 06:28
@ananyo2012 ananyo2012 force-pushed the coverage branch 10 times, most recently from 2fbd8ba to f5b854e Compare January 24, 2017 03:39
@ananyo2012
Copy link
Member Author

@jywarren This is good to go. You can get coverage and other issues from the badges included in readme: https://github.com/ananyo2012/plots2/tree/coverage#publiclaborg

@ananyo2012
Copy link
Member Author

The issues section in codeclimate shows various linting and security issues with the code. The test coverage is shown using coveralls. I used coveralls for test coverage since codeclimate requires admin access to get the repo_token. Coverall only requires a write access to the repo.

Sorry for too many builds occuring in the CI for the same PR as I was getting a tough time to figure out what was causing coveralls not sending reports. I finally figured this was because we were using docker for running tests which set the CI environment to false.

@jywarren
Copy link
Member

Oh cool, interesting, i'll check it out now!

@jywarren
Copy link
Member

Oh neat:

ConsoleReporter finished
[Coveralls] Submitting to https://coveralls.io/api/v1
[Coveralls] Job #5.1
[Coveralls] https://coveralls.io/jobs/22246854
Coverage is at 85.48%.
Coverage report sent to Coveralls.

85% is higher than i'd expected!

@jywarren jywarren merged commit 04f698d into publiclab:master Jan 24, 2017
@jywarren
Copy link
Member

Thanks, Ananyo, fantastic work!! 🎉

@yukiisbored
Copy link
Collaborator

yukiisbored commented Jan 24, 2017

It would be really cool if we hit 100% code coverage and enforce it once we reach it ;)

@jywarren
Copy link
Member

jywarren commented Jan 24, 2017 via email

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

Successfully merging this pull request may close these issues.

3 participants