Skip to content

Deprecation warning shows incorrect line #504

Open
@ms-ati

Description

@ms-ati

Hi @colszowka, after looking closely, I believe this bug filed against the Docile gem is actually better fixed here in SimpleCov, and will close that issue in favor of this one.

As the original issue states (thanks @BjornMelgaard), the deprecation warning is for SimpleCov#load_adapter, but it is presented to the user as originating in the Docile code (used for the SimpleCov DSL) rather than in the actual user code, for example:

/usr/lib/ruby/gems/2.3.0/gems/docile-1.1.5/lib/docile/fallback_context_proxy.rb:57:in `method_missing': [DEPRECATION] #load_adapter is deprecated. Use #load_profile instead.

I think what should actually be shown would be the user code, for example specs/spec_helper.rb:6: [DEPRECATION] #load_adapter is deprecated. Use #load_profile instead., or something similar, if that makes sense? I'm assuming that the spec_helper.rb contains a block which is passed to SimpleCov.start, that this is how Docile is getting in between the caller and the deprecation warning.

The current implementation in simplecov.rb:142 calls Kernel.caller.first directly. Would it be possible to change this deprecation warning so that it refers to the first non Docile/SimpleCov line in the callers, perhaps?

Thanks,
-Marc

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions