Exception: RuboCop::ErrorWithAnalyzedFileLocation

Inherits:
Error
  • Object
show all
Defined in:
lib/rubocop/error.rb

Overview

A wrapper to display errored location of analyzed file.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cause:, node:, cop:) ⇒ ErrorWithAnalyzedFileLocation

Returns a new instance of ErrorWithAnalyzedFileLocation.



14
15
16
17
18
19
# 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

#causeObject (readonly)

Returns the value of attribute cause.



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

def cause
  @cause
end

#copObject (readonly)

Returns the value of attribute cop.



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

def cop
  @cop
end

Instance Method Details

#columnObject



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

def column
  @location&.column
end

#lineObject



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

def line
  @location&.line
end

#messageObject



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

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