Fix newly found issues

This commit is contained in:
Sijawusz Pur Rahnama 2022-12-17 23:47:22 +01:00
parent 597372c645
commit 47b92fbb76
3 changed files with 3 additions and 3 deletions

View File

@ -2,7 +2,7 @@ require "../../spec_helper"
require "file_utils" require "file_utils"
module Ameba module Ameba
private def with_formatter private def with_formatter(&)
io = IO::Memory.new io = IO::Memory.new
formatter = Formatter::TODOFormatter.new(io) formatter = Formatter::TODOFormatter.new(io)

View File

@ -179,7 +179,7 @@ module Ameba
private MAX_ITERATIONS = 200 private MAX_ITERATIONS = 200
private def loop_unless_infinite(source, corrected_issues) private def loop_unless_infinite(source, corrected_issues, &)
# Keep track of the state of the source. If a rule modifies the source # Keep track of the state of the source. If a rule modifies the source
# and another rule undoes it producing identical source we have an # and another rule undoes it producing identical source we have an
# infinite loop. # infinite loop.

View File

@ -111,7 +111,7 @@ class Ameba::Source::Rewriter
end end
# Similar to `@children.bsearch_index || size` except allows for a starting point # Similar to `@children.bsearch_index || size` except allows for a starting point
protected def bsearch_child_index(from = 0) protected def bsearch_child_index(from = 0, &)
size = @children.size size = @children.size
(from...size).bsearch { |i| yield @children[i] } || size (from...size).bsearch { |i| yield @children[i] } || size
end end