Class: MilkTea::Linter::Warning

Inherits:
Data
  • Object
show all
Defined in:
lib/milk_tea/tooling/linter.rb

Overview

severity: :error | :warning | :hint

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path:, line:, column: nil, length: nil, code:, message:, severity: :warning, symbol_name: nil) ⇒ Warning

Returns a new instance of Warning.



105
# File 'lib/milk_tea/tooling/linter.rb', line 105

def initialize(path:, line:, column: nil, length: nil, code:, message:, severity: :warning, symbol_name: nil) = super

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code

Returns:

  • (Object)

    the current value of code



104
105
106
# File 'lib/milk_tea/tooling/linter.rb', line 104

def code
  @code
end

#columnObject (readonly)

Returns the value of attribute column

Returns:

  • (Object)

    the current value of column



104
105
106
# File 'lib/milk_tea/tooling/linter.rb', line 104

def column
  @column
end

#lengthObject (readonly)

Returns the value of attribute length

Returns:

  • (Object)

    the current value of length



104
105
106
# File 'lib/milk_tea/tooling/linter.rb', line 104

def length
  @length
end

#lineObject (readonly)

Returns the value of attribute line

Returns:

  • (Object)

    the current value of line



104
105
106
# File 'lib/milk_tea/tooling/linter.rb', line 104

def line
  @line
end

#messageObject (readonly)

Returns the value of attribute message

Returns:

  • (Object)

    the current value of message



104
105
106
# File 'lib/milk_tea/tooling/linter.rb', line 104

def message
  @message
end

#pathObject (readonly)

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path



104
105
106
# File 'lib/milk_tea/tooling/linter.rb', line 104

def path
  @path
end

#severityObject (readonly)

Returns the value of attribute severity

Returns:

  • (Object)

    the current value of severity



104
105
106
# File 'lib/milk_tea/tooling/linter.rb', line 104

def severity
  @severity
end

#symbol_nameObject (readonly)

Returns the value of attribute symbol_name

Returns:

  • (Object)

    the current value of symbol_name



104
105
106
# File 'lib/milk_tea/tooling/linter.rb', line 104

def symbol_name
  @symbol_name
end

Instance Method Details

#as_jsonObject



111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/milk_tea/tooling/linter.rb', line 111

def as_json(*)
  {
    path:,
    line:,
    column:,
    length:,
    code:,
    message:,
    severity: severity.to_s,
    symbol_name:,
  }.compact
end

#to_diagnosticObject



107
108
109
# File 'lib/milk_tea/tooling/linter.rb', line 107

def to_diagnostic
  Diagnostic.new(path:, line:, column:, length:, code:, message:, severity:, symbol_name:)
end