Git Product home page Git Product logo

Comments (11)

rtfpessoa avatar rtfpessoa commented on August 16, 2024 1

@ok. I just merged #25 and added a note in the README.

Will be released soon.

from ruby-codacy-coverage.

rtfpessoa avatar rtfpessoa commented on August 16, 2024

What would be the easiest solution on our side to fix this? (Ideally not depending on VCR gem)

from ruby-codacy-coverage.

dazza-codes avatar dazza-codes commented on August 16, 2024

In this gem: test whether VCR is loaded; if so, disable it when doing the post and then enable it again. It might look something like:

VCR.turn_off! if Object.const_defined?('VCR') && VCR.respond_to?(:turn_off!)
# push the coverage data
VCR.turn_on! if Object.const_defined?('VCR') && VCR.respond_to?(:turn_on!)

If that code change works, then the error should be avoided every time, regardless of VCR config changes. AFAIK, the VCR gem is always loaded as VCR.

For documentation purposes, note that adding an ignore clause to the VCR config can avoid this error, e.g. the following options are working on the project that raised this error:

require 'vcr'
VCR.configure do |config|
  # other config options
  c.allow_http_connections_when_no_cassette = false
  c.ignore_hosts 'api.codacy.com'
end

from ruby-codacy-coverage.

rtfpessoa avatar rtfpessoa commented on August 16, 2024

In the first example. Even if we do not require the gem we will be able to invoke a method on it?

from ruby-codacy-coverage.

dazza-codes avatar dazza-codes commented on August 16, 2024

Yes, there's nothing in that code that requires bundling the VCR gem. It just checks whether the VCR class (which has a constant name of 'VCR') is defined and, if it is, whether it responds to those VCR methods. Test it out to see whether it works without including the VCR gem, it should be OK.

from ruby-codacy-coverage.

rtfpessoa avatar rtfpessoa commented on August 16, 2024

We do not have any code using VCR. Are you able to test adding those two lines around https://github.com/codacy/ruby-codacy-coverage/blob/master/lib/codacy/client.rb#L26 locally and see if it works?

from ruby-codacy-coverage.

dazza-codes avatar dazza-codes commented on August 16, 2024

My only project using codacy currently contains VCR and could not run the test suite easily without it. If you do not have it, that's actually better, because it should not fail without VCR. (Passing the baton back to ya.)

from ruby-codacy-coverage.

rtfpessoa avatar rtfpessoa commented on August 16, 2024

@darrenleeweber released as version 1.1.4 let me know if it works.

from ruby-codacy-coverage.

dazza-codes avatar dazza-codes commented on August 16, 2024

Updating from 1.1.1 to 1.1.4 failed in this travis build

Not sure why exactly, as no other changes were made. There seems to be a residual problem with WebMock that turning off VCR doesn't handle completely. Perhaps the troubleshooting tip in the README is sufficient (and revert this change)? I'm going to check one more thing first.

from ruby-codacy-coverage.

dazza-codes avatar dazza-codes commented on August 16, 2024

Shoot, this is not working as expected. It may be that the project using both VCR and codacy-coverage needs to take responsibility for this. The easiest solution is already in the README#troubleshooting section. So, recommending scrapping the VCR-toggle solution and releasing a 1.1.5 to replace the 1.1.4 (mistake). Sorry I didn't see that coming.

from ruby-codacy-coverage.

rtfpessoa avatar rtfpessoa commented on August 16, 2024

Ok. Just reverted the toggle. 1.1.5.

from ruby-codacy-coverage.

Related Issues (15)

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.