From a7eed4b2304376a4be8e87d142cd3c85e6709ae1 Mon Sep 17 00:00:00 2001 From: Sijawusz Pur Rahnama Date: Mon, 6 Mar 2023 05:58:15 +0100 Subject: [PATCH] Bump ameba dependency and fix found issues --- .ameba.yml | 3 +++ shard.yml | 2 +- spec/backtracer/backtrace/frame/context_spec.cr | 2 +- spec/spec_helper.cr | 9 +++++---- src/backtracer.cr | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) create mode 100644 .ameba.yml diff --git a/.ameba.yml b/.ameba.yml new file mode 100644 index 0000000..399b108 --- /dev/null +++ b/.ameba.yml @@ -0,0 +1,3 @@ +Lint/NotNil: + Excluded: + - spec/backtracer/backtrace/frame/parser_spec.cr diff --git a/shard.yml b/shard.yml index 2266835..c718818 100644 --- a/shard.yml +++ b/shard.yml @@ -7,7 +7,7 @@ authors: development_dependencies: ameba: github: crystal-ameba/ameba - version: ~> 1.2.0 + version: ~> 1.4.0 crystal: ">= 0.35.0" diff --git a/spec/backtracer/backtrace/frame/context_spec.cr b/spec/backtracer/backtrace/frame/context_spec.cr index 1ec0a74..b6fc3aa 100644 --- a/spec/backtracer/backtrace/frame/context_spec.cr +++ b/spec/backtracer/backtrace/frame/context_spec.cr @@ -1,6 +1,6 @@ require "../../../spec_helper" -def with_foo_context +def with_foo_context(&) yield Backtracer::Backtrace::Frame::Context.new( lineno: 10, pre: %w[foo bar baz], diff --git a/spec/spec_helper.cr b/spec/spec_helper.cr index 11c6c86..ed152bb 100644 --- a/spec/spec_helper.cr +++ b/spec/spec_helper.cr @@ -1,15 +1,15 @@ require "spec" require "../src/backtracer" -def with_configuration(shared = true) +def with_configuration(shared = true, &) yield shared ? Backtracer.configuration : Backtracer::Configuration.new end -def with_backtrace(backtrace, **options) +def with_backtrace(backtrace, **options, &) yield Backtracer::Backtrace::Parser.parse(backtrace, **options) end -def with_frame(method, path = nil, lineno = nil, column = nil, **options) +def with_frame(method, path = nil, lineno = nil, column = nil, **options, &) line = String.build do |io| if path io << path @@ -28,7 +28,8 @@ def with_foo_frame( path = "#{__DIR__}/foo.cr", lineno = 1, column = 7, - **options + **options, + & ) with_frame(method, path, lineno, column, **options) do |frame| yield frame diff --git a/src/backtracer.cr b/src/backtracer.cr index 6d0f507..c507a2d 100644 --- a/src/backtracer.cr +++ b/src/backtracer.cr @@ -1,7 +1,7 @@ module Backtracer class_getter(configuration) { Configuration.new } - def self.configure : Nil + def self.configure(&) : Nil yield configuration end