Class: HamlLint::Lint

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

Overview

Contains information about a problem or issue with a HAML document.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(linter, filename, line, message, severity = :warning, corrected: false) ⇒ Lint

Creates a new lint.



31
32
33
34
35
36
37
38
# File 'lib/haml_lint/lint.rb', line 31

def initialize(linter, filename, line, message, severity = :warning, corrected: false) # rubocop:disable Metrics/ParameterLists
  @linter   = linter
  @filename = filename
  @line     = line || 0
  @message  = message
  @severity = Severity.new(severity)
  @corrected = corrected
end

Instance Attribute Details

#correctedBoolean (readonly)



7
8
9
# File 'lib/haml_lint/lint.rb', line 7

def corrected
  @corrected
end

#filenameString (readonly)



10
11
12
# File 'lib/haml_lint/lint.rb', line 10

def filename
  @filename
end

#lineString (readonly)



13
14
15
# File 'lib/haml_lint/lint.rb', line 13

def line
  @line
end

#linterSlimLint::Linter (readonly)



16
17
18
# File 'lib/haml_lint/lint.rb', line 16

def linter
  @linter
end

#messageString (readonly)



19
20
21
# File 'lib/haml_lint/lint.rb', line 19

def message
  @message
end

#severitySymbol (readonly)



22
23
24
# File 'lib/haml_lint/lint.rb', line 22

def severity
  @severity
end

Instance Method Details

#error?Boolean

Return whether this lint has a severity of error.



43
44
45
# File 'lib/haml_lint/lint.rb', line 43

def error?
  @severity.error?
end

#inspectObject



47
48
49
50
# File 'lib/haml_lint/lint.rb', line 47

def inspect
  "#{self.class.name}(corrected=#{corrected}, filename=#{filename}, line=#{line}, " \
    "linter=#{linter.class.name}, message=#{message}, severity=#{severity})"
end