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

Use original callstack in the DeprecationsDetector::Collect class #12

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/deprecations_detector/collect.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module DeprecationsDetector
class Collect
def self.call(message = "", callstack = [], deprecation_horizon = nil, gem_name = nil)
DeprecationsDetector::Main.add_deprecation(message, caller)
DeprecationsDetector::Main.add_deprecation(message, callstack.map(&:to_s))
Copy link
Member

Choose a reason for hiding this comment

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

Does it work?
As far as I remember the callstack is filtered out here, leaving just the files inside the root_path.

end

def self.arity
Expand Down
4 changes: 4 additions & 0 deletions spec/faked_project/lib/faked_project/some_class.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ def initialize(label)
end

def reverse
deprecated_reverse
Copy link
Member

Choose a reason for hiding this comment

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

Do you mind deprecating reverse?

end

def deprecated_reverse
deprecator = ActiveSupport::Deprecation.new
deprecator.behavior = DeprecationsDetector::Collect
deprecator.warn('My Deprecation')
Expand Down
Loading