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
-
#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
20 21 22 |
# File 'lib/why_classes/offense.rb', line 20 def correctable? correctable && !corrector.nil? end |
#position ⇒ Object
Sort key: by position within a file.
25 26 27 |
# File 'lib/why_classes/offense.rb', line 25 def position [line, column] end |