Skip to content

Fixed bug preventing non-rails apps to fail to transfer coverage to code climate #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

Merged
merged 4 commits into from
Feb 24, 2015

Conversation

peppyheppy
Copy link
Contributor

After setting up code climate in my non-rails app I noticed that I was not transmitting the coverage report up to codeclimate due to some bad/wrong code that relied on defined? and Rails.root incorrectly.

The "fix" for the Rails.root support also didn't have tests.

So, I added a fix to support non rails and wrote tests to make sure that we wouldn't have trouble going forward.

Here is the original exception:

Coverage = 100.0%. Code Climate encountered an exception: NoMethodError
undefined method `root' for Rails:Module
/home/ubuntu/census/vendor/bundle/ruby/1.9.1/gems/codeclimate-test-reporter-0.4.6/lib/code_climate/test_reporter/git.rb:61:in `rails_git_dir_present?'
/home/ubuntu/census/vendor/bundle/ruby/1.9.1/gems/codeclimate-test-reporter-0.4.6/lib/code_climate/test_reporter/git.rb:53:in `git_dir'
/home/ubuntu/census/vendor/bundle/ruby/1.9.1/gems/codeclimate-test-reporter-0.4.6/lib/code_climate/test_reporter/git.rb:48:in `git'
/home/ubuntu/census/vendor/bundle/ruby/1.9.1/gems/codeclimate-test-reporter-0.4.6/lib/code_climate/test_reporter/git.rb:35:in `head'
/home/ubuntu/census/vendor/bundle/ruby/1.9.1/gems/codeclimate-test-reporter-0.4.6/lib/code_climate/test_reporter/git.rb:8:in `info'
/home/ubuntu/census/vendor/bundle/ruby/1.9.1/gems/codeclimate-test-reporter-0.4.6/lib/code_climate/test_reporter/formatter.rb:72:in `to_payload'
/home/ubuntu/census/vendor/bundle/ruby/1.9.1/gems/codeclimate-test-reporter-0.4.6/lib/code_climate/test_reporter/formatter.rb:20:in `format'
/home/ubuntu/census/vendor/bundle/ruby/1.9.1/gems/simplecov-0.9.1/lib/simplecov/result.rb:46:in `format!'
/home/ubuntu/census/vendor/bundle/ruby/1.9.1/gems/simplecov-0.9.1/lib/simplecov/configuration.rb:158:in `block in at_exit'
/home/ubuntu/census/vendor/bundle/ruby/1.9.1/gems/simplecov-0.9.1/lib/simplecov/defaults.rb:54:in `call'
/home/ubuntu/census/vendor/bundle/ruby/1.9.1/gems/simplecov-0.9.1/lib/simplecov/defaults.rb:54:in `block in <top (required)>'

peppyheppy added 2 commits February 19, 2015 23:07
…ned?' which caused the defined to always return truthy becuase defined returned a string; irony alert: added missing test coverage
@peppyheppy
Copy link
Contributor Author

Please let me know if you have any questions. I would love to update my Gemfile on my app and point it to the fixed published gem.

@@ -16,3 +16,4 @@ spec/reports
test/tmp
test/version_tmp
tmp
*.sw[^f]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is not necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved this to my global ignore (thought others using vim would appreciate it.) Will update shortly.

Would you like me to remove the other unnecessary ignores? I'd be happy to.

@peppyheppy
Copy link
Contributor Author

@calavera Please reconsider this pull request.

calavera added a commit that referenced this pull request Feb 24, 2015
Fixed bug preventing non-rails apps to fail to transfer coverage to code climate
@calavera calavera merged commit fc0dcb1 into codeclimate:master Feb 24, 2015
@calavera
Copy link
Contributor

Merged, thanks for your contribution!

@marnen
Copy link

marnen commented Feb 26, 2015

This looks great! Do you know when this will make it into a release?

@calavera
Copy link
Contributor

@marnen I just pushed version 0.4.7 to rubygems.org with this change 💥

Thanks again @peppyheppy

@marnen
Copy link

marnen commented Feb 26, 2015

@calavera @peppyheppy Thanks!

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