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
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/rubocop-rspec-3.0.3/lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-3.3.0 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-3.2.0 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-3.1.0 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-3.0.5 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-3.0.4 lib/rubocop/cop/rspec/mixin/final_end_location.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/rubocop-rspec-3.0.1/lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-3.0.3 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-3.0.2 lib/rubocop/cop/rspec/mixin/final_end_location.rb
katalyst-govuk-formbuilder-1.9.2 vendor/bundle/ruby/3.3.0/gems/rubocop-rspec-3.0.1/lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-3.0.1 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-3.0.0 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-3.0.0.pre lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.31.0 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.30.0 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.29.2 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.29.1 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.29.0 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.28.0 lib/rubocop/cop/rspec/mixin/final_end_location.rb
rubocop-rspec-2.27.1 lib/rubocop/cop/rspec/mixin/final_end_location.rb