Class: HamlLint::Lint
- Inherits:
-
Object
- Object
- HamlLint::Lint
- Defined in:
- lib/haml_lint/lint.rb
Overview
Contains information about a problem or issue with a HAML document.
Instance Attribute Summary collapse
-
#corrected ⇒ Boolean
readonly
If the error was corrected by auto-correct.
-
#filename ⇒ String
readonly
File path to which the lint applies.
-
#line ⇒ String
readonly
Line number of the file the lint corresponds to.
-
#linter ⇒ SlimLint::Linter
readonly
Linter that reported the lint.
-
#message ⇒ String
readonly
Error/warning message to display to user.
-
#severity ⇒ Symbol
readonly
Whether this lint is a warning or an error.
Instance Method Summary collapse
-
#error? ⇒ Boolean
Return whether this lint has a severity of error.
-
#initialize(linter, filename, line, message, severity = :warning, corrected: false) ⇒ Lint
constructor
Creates a new lint.
- #inspect ⇒ Object
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, , severity = :warning, corrected: false) # rubocop:disable Metrics/ParameterLists @linter = linter @filename = filename @line = line || 0 @message = @severity = Severity.new(severity) @corrected = corrected end |
Instance Attribute Details
#corrected ⇒ Boolean (readonly)
Returns If the error was corrected by auto-correct.
7 8 9 |
# File 'lib/haml_lint/lint.rb', line 7 def corrected @corrected end |
#filename ⇒ String (readonly)
Returns file path to which the lint applies.
10 11 12 |
# File 'lib/haml_lint/lint.rb', line 10 def filename @filename end |
#line ⇒ String (readonly)
Returns line number of the file the lint corresponds to.
13 14 15 |
# File 'lib/haml_lint/lint.rb', line 13 def line @line end |
#linter ⇒ SlimLint::Linter (readonly)
Returns linter that reported the lint.
16 17 18 |
# File 'lib/haml_lint/lint.rb', line 16 def linter @linter end |
#message ⇒ String (readonly)
Returns error/warning message to display to user.
19 20 21 |
# File 'lib/haml_lint/lint.rb', line 19 def @message end |
#severity ⇒ Symbol (readonly)
Returns whether this lint is a warning or an error.
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 |
#inspect ⇒ Object
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=#{}, severity=#{severity})" end |