Skip to content

Commit

Permalink
Fix ameba’s Lint/MissingBlockArgument and Lint/UnusedArgument off…
Browse files Browse the repository at this point in the history
…ences
  • Loading branch information
Sija committed Dec 19, 2022
1 parent 2cd0cb0 commit 7f5a922
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion spec/raven/breadcrumb_buffer_spec.cr
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "../spec_helper"

private def with_breadcrumb_buffer
private def with_breadcrumb_buffer(&)
breadcrumbs = Raven::BreadcrumbBuffer.new(10)
yield breadcrumbs
end
Expand Down
2 changes: 1 addition & 1 deletion spec/raven/client_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ private class ClientTest < Raven::Client
end
end

private def with_client
private def with_client(&)
yield ClientTest.new(build_configuration)
end

Expand Down
2 changes: 1 addition & 1 deletion spec/raven/client_state_spec.cr
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require "../spec_helper"
require "timecop"

private def with_client_state
private def with_client_state(&)
yield Raven::Client::State.new
end

Expand Down
4 changes: 2 additions & 2 deletions spec/raven/configuration_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ private class RandomSampleFail < Random::PCG32
end
end

private def with_configuration
private def with_configuration(&)
with_clean_env do
yield Raven::Configuration.new
end
end

private def with_configuration_with_dsn
private def with_configuration_with_dsn(&)
with_configuration do |configuration|
configuration.dsn = "http://12345:[email protected]:3000/sentry/42"
yield configuration
Expand Down
4 changes: 2 additions & 2 deletions spec/raven/event_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Raven::Test
class Exception < ::Exception; end
end

private def with_event(clear = true, **opts)
private def with_event(clear = true, **opts, &)
if clear
Raven::Context.clear!
Raven::BreadcrumbBuffer.clear!
Expand All @@ -13,7 +13,7 @@ private def with_event(clear = true, **opts)
yield event
end

private def with_event_hash(**opts)
private def with_event_hash(**opts, &)
with_event(**opts) do |event|
yield event.to_hash
end
Expand Down
2 changes: 1 addition & 1 deletion spec/raven/instance_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ private class InstanceTest < Raven::Instance
end
end

private def with_instance(context = nil)
private def with_instance(context = nil, &)
yield InstanceTest.new(context, build_configuration)
end

Expand Down
2 changes: 1 addition & 1 deletion spec/raven/log_backend_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ private def build_logger(source = nil, **opts)
.for(source.to_s)
end

private def with_clean_configuration
private def with_clean_configuration(&)
prev_configuration = Raven.instance.configuration.dup
begin
Raven.instance.configuration = build_configuration
Expand Down
2 changes: 1 addition & 1 deletion spec/raven/processors/spec_helper.cr
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "../../spec_helper"

def with_processor(klass : Raven::Processor.class)
def with_processor(klass : Raven::Processor.class, &)
configuration = Raven::Configuration.new
client = Raven::Client.new(configuration)
processor = klass.new(client)
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.cr
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ require "log/spec"
require "../src/raven"

# Make sure we reset the env in case something leaks in
def with_clean_env
def with_clean_env(&)
sentry_vars = ->{ ENV.to_h.select { |key, _| key.starts_with?("SENTRY_") } }
previous_vars = sentry_vars.call
begin
Expand Down
4 changes: 2 additions & 2 deletions src/crash_handler.cr
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ module Raven
end
end

private def capture_with_options(*args, **options)
private def capture_with_options(*args, **options, &)
options = DEFAULT_OPTS.merge(options)
capture(*args, **options) do |event|
yield event
Expand All @@ -84,7 +84,7 @@ module Raven
capture_with_options(*args, **options) { }
end

private def capture_with_options(**options)
private def capture_with_options(**options, &)
yield
rescue ex : Raven::Error
raise ex # Don't capture Raven errors
Expand Down
4 changes: 2 additions & 2 deletions src/raven/breadcrumb_buffer.cr
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module Raven
@buffer << crumb
end

def record(**opts) : Nil
def record(**opts, &) : Nil
crumb = Breadcrumb.new(**opts)
yield crumb
record crumb
Expand All @@ -50,7 +50,7 @@ module Raven
members.last?
end

def each
def each(&)
members.each do |breadcrumb|
yield breadcrumb
end
Expand Down
8 changes: 4 additions & 4 deletions src/raven/instance.cr
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ module Raven
end

# :ditto:
def configure
def configure(&)
yield configuration
configure
end
Expand Down Expand Up @@ -127,7 +127,7 @@ module Raven
# event.extra.merge! foo: "bar"
# end
# ```
def capture(obj : Exception | String, **options, &block)
def capture(obj : Exception | String, **options, &)
unless configuration.capture_allowed?(obj)
Log.debug {
"'#{obj}' excluded from capture: #{configuration.error_messages}"
Expand Down Expand Up @@ -190,7 +190,7 @@ module Raven
# NOTE: Useful in scenarios where you need to reconstruct the error
# (usually along with a backtrace from external source), while
# having no access to the actual Exception object.
def capture(klass : String, message : String, backtrace : String? = nil, **options, &block)
def capture(klass : String, message : String, backtrace : String? = nil, **options, &)
formatted_message = "#{klass}: #{message}"
capture(formatted_message, **options) do |event|
ex = Interface::SingleException.new.tap do |iface|
Expand Down Expand Up @@ -219,7 +219,7 @@ module Raven
# MyApp.run
# end
# ```
def capture(**options, &block)
def capture(**options, &)
yield
rescue ex : Raven::Error
raise ex # Don't capture Raven errors
Expand Down

0 comments on commit 7f5a922

Please sign in to comment.