Class: Rigor::Analysis::Diagnostic
- Inherits:
-
Object
- Object
- Rigor::Analysis::Diagnostic
- Defined in:
- lib/rigor/analysis/diagnostic.rb
Instance Attribute Summary collapse
-
#column ⇒ Object
readonly
Returns the value of attribute column.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#rule ⇒ Object
readonly
Returns the value of attribute rule.
-
#severity ⇒ Object
readonly
Returns the value of attribute severity.
Instance Method Summary collapse
- #error? ⇒ Boolean
-
#initialize(path:, line:, column:, message:, severity: :error, rule: nil) ⇒ Diagnostic
constructor
‘rule:` is the stable identifier (a kebab-case string) of the diagnostic’s source rule.
- #to_h ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(path:, line:, column:, message:, severity: :error, rule: nil) ⇒ Diagnostic
‘rule:` is the stable identifier (a kebab-case string) of the diagnostic’s source rule. It is used by the configuration and the in-source ‘# rigor:disable <rule>` suppression comment system to identify diagnostics by category. Diagnostics not produced by `CheckRules` (parse errors, path errors, internal analyzer errors) may leave `rule` as nil and stay unsuppressible. rubocop:disable Metrics/ParameterLists
16 17 18 19 20 21 22 23 24 |
# File 'lib/rigor/analysis/diagnostic.rb', line 16 def initialize(path:, line:, column:, message:, severity: :error, rule: nil) # rubocop:enable Metrics/ParameterLists @path = path @line = line @column = column @message = @severity = severity @rule = rule end |
Instance Attribute Details
#column ⇒ Object (readonly)
Returns the value of attribute column.
6 7 8 |
# File 'lib/rigor/analysis/diagnostic.rb', line 6 def column @column end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
6 7 8 |
# File 'lib/rigor/analysis/diagnostic.rb', line 6 def line @line end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
6 7 8 |
# File 'lib/rigor/analysis/diagnostic.rb', line 6 def @message end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
6 7 8 |
# File 'lib/rigor/analysis/diagnostic.rb', line 6 def path @path end |
#rule ⇒ Object (readonly)
Returns the value of attribute rule.
6 7 8 |
# File 'lib/rigor/analysis/diagnostic.rb', line 6 def rule @rule end |
#severity ⇒ Object (readonly)
Returns the value of attribute severity.
6 7 8 |
# File 'lib/rigor/analysis/diagnostic.rb', line 6 def severity @severity end |
Instance Method Details
#error? ⇒ Boolean
26 27 28 |
# File 'lib/rigor/analysis/diagnostic.rb', line 26 def error? severity == :error end |
#to_h ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/rigor/analysis/diagnostic.rb', line 30 def to_h { "path" => path, "line" => line, "column" => column, "severity" => severity.to_s, "rule" => rule, "message" => } end |
#to_s ⇒ Object
41 42 43 |
# File 'lib/rigor/analysis/diagnostic.rb', line 41 def to_s "#{path}:#{line}:#{column}: #{severity}: #{}" end |