Class: LintTrappings::Lint

Inherits:
Object
  • Object
show all
Defined in:
lib/lint_trappings/lint.rb

Overview

Contains information about a problem or issue with a document.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Lint

Returns a new instance of Lint.

Parameters:

  • options (Hash)

Options Hash (options):



28
29
30
31
32
33
34
35
# File 'lib/lint_trappings/lint.rb', line 28

def initialize(options)
  @linter       = options[:linter]
  @path         = options.fetch(:path)
  @source_range = options.fetch(:source_range)
  @message      = options.fetch(:message)
  @severity     = options.fetch(:severity)
  @exception    = options[:exception]
end

Instance Attribute Details

#exceptionException (readonly)

Returns the exception that was raised, if any.

Returns:

  • (Exception)

    the exception that was raised, if any



20
21
22
# File 'lib/lint_trappings/lint.rb', line 20

def exception
  @exception
end

#linterLintTrappings::Linter? (readonly)

Returns linter that reported the lint (if applicable).

Returns:



5
6
7
# File 'lib/lint_trappings/lint.rb', line 5

def linter
  @linter
end

#messageString (readonly)

Returns message describing the lint.

Returns:

  • (String)

    message describing the lint



14
15
16
# File 'lib/lint_trappings/lint.rb', line 14

def message
  @message
end

#pathString (readonly)

Returns file path to which the lint applies.

Returns:

  • (String)

    file path to which the lint applies



8
9
10
# File 'lib/lint_trappings/lint.rb', line 8

def path
  @path
end

#severitySymbol (readonly)

Returns whether this lint is a warning or an error.

Returns:

  • (Symbol)

    whether this lint is a warning or an error



17
18
19
# File 'lib/lint_trappings/lint.rb', line 17

def severity
  @severity
end

#source_rangeRange<LintTrappings::Location> (readonly)

Returns source range of the problem within the file.

Returns:



11
12
13
# File 'lib/lint_trappings/lint.rb', line 11

def source_range
  @source_range
end