123456789_123456789_123456789_123456789_123456789_

Exception: RuboCop::ErrorWithAnalyzedFileLocation

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Error, StandardError
Instance Chain:
self, Error, StandardError
Inherits: RuboCop::Error
  • Object
Defined in: lib/rubocop/error.rb

Overview

A wrapper to display errored location of analyzed file.

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(cause:, node:, cop:) ⇒ ErrorWithAnalyzedFileLocation

[ GitHub ]

  
# File 'lib/rubocop/error.rb', line 14

def initialize(cause:, node:, cop:)
  super()
  @cause = cause
  @cop = cop
  @location = node.is_a?(RuboCop::AST::Node) ? node.loc : node
end

Instance Attribute Details

#cause (readonly)

[ GitHub ]

  
# File 'lib/rubocop/error.rb', line 21

attr_reader :cause, :cop

#cop (readonly)

[ GitHub ]

  
# File 'lib/rubocop/error.rb', line 21

attr_reader :cause, :cop

Instance Method Details

#column

[ GitHub ]

  
# File 'lib/rubocop/error.rb', line 27

def column
  @location&.column
end

#line

[ GitHub ]

  
# File 'lib/rubocop/error.rb', line 23

def line
  @location&.line
end

#message

[ GitHub ]

  
# File 'lib/rubocop/error.rb', line 31

def message
  "cause: #{cause.inspect}"
end