Class: WhyClasses::Offense
- Inherits:
-
Data
- Object
- Data
- WhyClasses::Offense
- Defined in:
- lib/why_classes/offense.rb
Overview
An immutable finding produced by a Rule.
corrector is nil for advice-only offenses, or a callable taking a
Parser::Source::TreeRewriter and queueing the edits that apply the
suggested refactoring.
Instance Attribute Summary collapse
-
#column ⇒ Object
readonly
Returns the value of attribute column.
-
#correctable ⇒ Object
readonly
Returns the value of attribute correctable.
-
#corrector ⇒ Object
readonly
Returns the value of attribute corrector.
-
#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_name ⇒ Object
readonly
Returns the value of attribute rule_name.
-
#severity ⇒ Object
readonly
Returns the value of attribute severity.
-
#suggestion ⇒ Object
readonly
Returns the value of attribute suggestion.
Instance Method Summary collapse
-
#correctable? ⇒ Boolean
Whether a corrector is available (display marker).
-
#position ⇒ Object
Sort key: by position within a file.
Instance Attribute Details
#column ⇒ Object (readonly)
Returns the value of attribute column
9 10 11 |
# File 'lib/why_classes/offense.rb', line 9 def column @column end |
#correctable ⇒ Object (readonly)
Returns the value of attribute correctable
9 10 11 |
# File 'lib/why_classes/offense.rb', line 9 def correctable @correctable end |
#corrector ⇒ Object (readonly)
Returns the value of attribute corrector
9 10 11 |
# File 'lib/why_classes/offense.rb', line 9 def corrector @corrector end |
#line ⇒ Object (readonly)
Returns the value of attribute line
9 10 11 |
# File 'lib/why_classes/offense.rb', line 9 def line @line end |
#message ⇒ Object (readonly)
Returns the value of attribute message
9 10 11 |
# File 'lib/why_classes/offense.rb', line 9 def @message end |
#path ⇒ Object (readonly)
Returns the value of attribute path
9 10 11 |
# File 'lib/why_classes/offense.rb', line 9 def path @path end |
#rule_name ⇒ Object (readonly)
Returns the value of attribute rule_name
9 10 11 |
# File 'lib/why_classes/offense.rb', line 9 def rule_name @rule_name end |
#severity ⇒ Object (readonly)
Returns the value of attribute severity
9 10 11 |
# File 'lib/why_classes/offense.rb', line 9 def severity @severity end |
#suggestion ⇒ Object (readonly)
Returns the value of attribute suggestion
9 10 11 |
# File 'lib/why_classes/offense.rb', line 9 def suggestion @suggestion end |
Instance Method Details
#correctable? ⇒ Boolean
Whether a corrector is available (display marker). Stays true across cache round-trips even though the non-serializable corrector proc is dropped; actually applying an edit checks #corrector directly (see CorrectionPlan).
23 24 25 |
# File 'lib/why_classes/offense.rb', line 23 def correctable? correctable end |
#position ⇒ Object
Sort key: by position within a file.
28 29 30 |
# File 'lib/why_classes/offense.rb', line 28 def position [line, column] end |