-
Notifications
You must be signed in to change notification settings - Fork 174
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
Breadcrumbs/leave breadcrumb #511
Conversation
Rubocop has an issue with the length of the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor comments, otherwise lgtm
.rubocop_todo.yml
Outdated
@@ -302,7 +302,7 @@ Metrics/MethodLength: | |||
# Offense count: 1 | |||
# Configuration parameters: CountComments. | |||
Metrics/ModuleLength: | |||
Max: 125 | |||
Max: 140 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be preferable to add lib/bugsnag.rb to Exclude
instead of repeatedly bumping this limit.
lib/bugsnag.rb
Outdated
unless breadcrumb.ignore? | ||
# Run callbacks | ||
configuration.before_breadcrumb_callbacks.each do |c| | ||
(c.arity > 0 ? c.call(breadcrumb) : c.call) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Outermost parentheses are unnecessary here
# Run callbacks | ||
configuration.before_breadcrumb_callbacks.each do |c| | ||
(c.arity > 0 ? c.call(breadcrumb) : c.call) | ||
break if breadcrumb.ignore? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can return
here instead of break
ing because it shouldn't proceed further if it is ignored.
spec/bugsnag_spec.rb
Outdated
@@ -133,4 +133,153 @@ module Kernel | |||
Kernel.send(:remove_const, :REQUIRED) | |||
end | |||
end | |||
|
|||
describe "#leave_breadcrumb" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.leave_breadcrumb
(.
instead of #
as it is a module/class method on Bugsnag
instead of an instance method)
spec/bugsnag_spec.rb
Outdated
end | ||
|
||
it "runs callbacks before leaving" do | ||
Bugsnag.configuration.before_breadcrumb_callbacks << Proc.new { |breadcrumb| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I normally see do
+ end
for multi-line blocks instead of curly braces ("Avoid using {...} for multi-line blocks" at https://github.com/rubocop-hq/ruby-style-guide#single-line-blocks )
lib/bugsnag.rb
Outdated
break if breadcrumb.ignore? | ||
end | ||
|
||
# Validate again incase of callback alteration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"in case" (with a space in between)
Goal
Adds the
leave_breadcrumb
method and associated tests for the Breadcrumbs implementation.