Sha256: cd86e9c2f99c8c0b457efc33015a96d4317800c1b6f7c335173283af53f842ce

Contents?: true

Size: 500 Bytes

Versions: 73

Compression:

Stored size: 500 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module RSpec
      # Helps find the true end location of nodes which might contain heredocs.
      module FinalEndLocation
        def final_end_location(start_node)
          heredoc_endings =
            start_node.each_node(:str, :dstr, :xstr)
              .select(&:heredoc?)
              .map { |node| node.loc.heredoc_end }

          [start_node.loc.end, *heredoc_endings].max_by(&:line)
        end
      end
    end
  end
end

Version data entries

73 entries across 67 versions & 7 rubygems

Version Path
rubocop-rspec-2.27.0 lib/rubocop/cop/rspec/mixin/final_end_location.rb
mlh-rubocop-config-1.0.3 vendor/bundle/ruby/3.2.0/gems/rubocop-rspec-2.26.1/lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.26.1 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.26.0 lib/rubocop/cop/rspec/mixin/final_end_location.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rubocop-rspec-2.9.0/lib/rubocop/cop/rspec/mixin/final_end_location.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rubocop-rspec-2.22.0/lib/rubocop/cop/rspec/mixin/final_end_location.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/mixin/final_end_location.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.25.0 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.24.1 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.24.0 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.23.2 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.23.1 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.23.0 lib/rubocop/cop/rspec/mixin/final_end_location.rb
mlh-rubocop-config-1.0.2 vendor/bundle/ruby/3.2.0/gems/rubocop-rspec-2.22.0/lib/rubocop/cop/rspec/mixin/final_end_location.rb
fablicop-1.10.3 vendor/bundle/ruby/3.2.0/gems/rubocop-rspec-2.22.0/lib/rubocop/cop/rspec/mixin/final_end_location.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/rubocop-rspec-2.12.1/lib/rubocop/cop/rspec/mixin/final_end_location.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/rubocop-rspec-2.9.0/lib/rubocop/cop/rspec/mixin/final_end_location.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/rubocop-rspec-2.13.1/lib/rubocop/cop/rspec/mixin/final_end_location.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/rubocop-rspec-2.22.0/lib/rubocop/cop/rspec/mixin/final_end_location.rb