diff --git a/Gemfile b/Gemfile index f1ca2274..e584ffa4 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,6 @@ source "https://rubygems.org" gemspec # Development dependencies -gem "bundler", ">= 2.5.23" gem "debug", ">= 1.11.1" gem "guard-rspec", "~> 4.0" gem "rake", "~> 13.0" diff --git a/bin/verify-sample-code b/bin/verify-sample-code index b1c73a62..ad259441 100755 --- a/bin/verify-sample-code +++ b/bin/verify-sample-code @@ -13,6 +13,7 @@ repos = { "spec/rspec/core/formatters/progress_formatter_spec.rb", "spec/rspec/core/formatters_spec.rb", "spec/rspec/core/formatters/documentation_formatter_spec.rb", + "spec/rspec/core/memoized_helpers_spec.rb", ].join(","), }, }, diff --git a/lib/rufo/erb_formatter.rb b/lib/rufo/erb_formatter.rb index 3f146c45..2509c619 100644 --- a/lib/rufo/erb_formatter.rb +++ b/lib/rufo/erb_formatter.rb @@ -126,6 +126,7 @@ def format_affix(affix, levels, type) end CODE_BLOCK_KEYWORDS = %w[BEGIN END begin case class def do else elsif end ensure for if module rescue unless until while] + private_constant :CODE_BLOCK_KEYWORDS def code_block_token?(token) _, kind, value = token diff --git a/lib/rufo/formatter.rb b/lib/rufo/formatter.rb index 2a16febc..5adbbf39 100644 --- a/lib/rufo/formatter.rb +++ b/lib/rufo/formatter.rb @@ -646,7 +646,7 @@ def format_simple_string(node) def with_unmodifiable_string_lines line = @line yield - (line + 1..@line).each do |i| + ((line + 1)..@line).each do |i| @unmodifiable_string_lines[i] = true end end @@ -4041,7 +4041,7 @@ def dedent_calls next unless first_paren_end_line == last_line diff = first_param_indent - indent - (first_line + 1..last_line).each do |line| + ((first_line + 1)..last_line).each do |line| @line_to_call_info.delete(line) next if @unmodifiable_string_lines[line] @@ -4068,7 +4068,7 @@ def indent_literals modified_lines = [] @literal_indents.each do |first_line, last_line, indent| - (first_line + 1..last_line).each do |line| + ((first_line + 1)..last_line).each do |line| next if @unmodifiable_string_lines[line] current_line = lines[line] @@ -4117,7 +4117,7 @@ def do_align(components, scope) # Move all lines affected by the assignment shift if scope == :assign && (range = @assignments_ranges[line]) - (line + 1..range).each do |line_number| + ((line + 1)..range).each do |line_number| lines[line_number] = "#{filler}#{lines[line_number]}" # And move other elements too if applicable