Class: BugInstance
- Inherits:
-
Object
- Object
- BugInstance
- Defined in:
- lib/spotbugs/entity/bug_instance.rb
Overview
Represent a BugInstance.
Constant Summary collapse
- RANK_ERROR_THRESHOLD =
4
Instance Attribute Summary collapse
-
#absolute_path ⇒ Object
readonly
Returns the value of attribute absolute_path.
-
#bug_instance ⇒ Object
Returns the value of attribute bug_instance.
-
#relative_path ⇒ Object
readonly
Returns the value of attribute relative_path.
-
#source_dirs ⇒ Object
Returns the value of attribute source_dirs.
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(prefix, source_dirs, bug_instance) ⇒ BugInstance
constructor
A new instance of BugInstance.
- #line ⇒ Object
- #rank ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(prefix, source_dirs, bug_instance) ⇒ BugInstance
Returns a new instance of BugInstance.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/spotbugs/entity/bug_instance.rb', line 9 def initialize(prefix, source_dirs, bug_instance) @source_dirs = source_dirs @bug_instance = bug_instance source_path = get_source_path(bug_instance) @absolute_path = get_absolute_path(source_path) prefix += (prefix.end_with?(file_separator) ? '' : file_separator) @relative_path = get_relative_path(prefix, @absolute_path) end |
Instance Attribute Details
#absolute_path ⇒ Object (readonly)
Returns the value of attribute absolute_path.
6 7 8 |
# File 'lib/spotbugs/entity/bug_instance.rb', line 6 def absolute_path @absolute_path end |
#bug_instance ⇒ Object
Returns the value of attribute bug_instance.
7 8 9 |
# File 'lib/spotbugs/entity/bug_instance.rb', line 7 def bug_instance @bug_instance end |
#relative_path ⇒ Object (readonly)
Returns the value of attribute relative_path.
6 7 8 |
# File 'lib/spotbugs/entity/bug_instance.rb', line 6 def relative_path @relative_path end |
#source_dirs ⇒ Object
Returns the value of attribute source_dirs.
7 8 9 |
# File 'lib/spotbugs/entity/bug_instance.rb', line 7 def source_dirs @source_dirs end |
Instance Method Details
#description ⇒ Object
32 33 34 |
# File 'lib/spotbugs/entity/bug_instance.rb', line 32 def description @description ||= bug_instance.xpath('LongMessage').text end |
#line ⇒ Object
28 29 30 |
# File 'lib/spotbugs/entity/bug_instance.rb', line 28 def line @line ||= get_value_safely(bug_instance.xpath('SourceLine').attribute('start'), 0).to_i end |
#rank ⇒ Object
20 21 22 |
# File 'lib/spotbugs/entity/bug_instance.rb', line 20 def rank @rank ||= bug_instance.attribute('rank').value.to_i end |
#type ⇒ Object
24 25 26 |
# File 'lib/spotbugs/entity/bug_instance.rb', line 24 def type @type ||= rank > RANK_ERROR_THRESHOLD ? :warn : :fail end |