Class: CheckstyleOutputToken
- Inherits:
-
Object
- Object
- CheckstyleOutputToken
- Defined in:
- lib/checkstyle_output_token.rb
Overview
Data bag to capture fields used to generate suppressions from an offending checkstyle output line
Constant Summary collapse
- OFFENSE_CONVERSION =
{ 'noTrailingWhitespace' => 'RegexpSinglelineCheck', 'noConsecutiveLines' => 'RegexpMultilineCheck', 'commentFirstSentenceMultiline' => 'RegexpMultilineCheck', 'commentFirstSentenceSingleline' => 'RegexpSinglelineCheck' }.freeze
Instance Attribute Summary collapse
-
#file_name ⇒ Object
readonly
Returns the value of attribute file_name.
-
#offense ⇒ Object
readonly
Returns the value of attribute offense.
-
#severity ⇒ Object
readonly
Returns the value of attribute severity.
Instance Method Summary collapse
-
#initialize(token_data) ⇒ CheckstyleOutputToken
constructor
A new instance of CheckstyleOutputToken.
- #to_suppression ⇒ Object
Constructor Details
#initialize(token_data) ⇒ CheckstyleOutputToken
Returns a new instance of CheckstyleOutputToken.
14 15 16 17 18 |
# File 'lib/checkstyle_output_token.rb', line 14 def initialize(token_data) @severity = token_data[1] @file_name = token_data[2] @offense = OFFENSE_CONVERSION[token_data[3]] || token_data[3] end |
Instance Attribute Details
#file_name ⇒ Object (readonly)
Returns the value of attribute file_name.
5 6 7 |
# File 'lib/checkstyle_output_token.rb', line 5 def file_name @file_name end |
#offense ⇒ Object (readonly)
Returns the value of attribute offense.
5 6 7 |
# File 'lib/checkstyle_output_token.rb', line 5 def offense @offense end |
#severity ⇒ Object (readonly)
Returns the value of attribute severity.
5 6 7 |
# File 'lib/checkstyle_output_token.rb', line 5 def severity @severity end |
Instance Method Details
#to_suppression ⇒ Object
20 21 22 |
# File 'lib/checkstyle_output_token.rb', line 20 def to_suppression " <suppress checks=\"#{offense}\" files=\"#{file_name}\"/>" end |