Class: Scanny::Issue
- Inherits:
-
Object
- Object
- Scanny::Issue
- Defined in:
- lib/scanny/issue.rb
Instance Attribute Summary collapse
-
#cwe ⇒ Object
readonly
Returns the value of attribute cwe.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#impact ⇒ Object
readonly
Returns the value of attribute impact.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(file, line, impact, message, cwe = nil) ⇒ Issue
constructor
A new instance of Issue.
- #to_s ⇒ Object
Constructor Details
#initialize(file, line, impact, message, cwe = nil) ⇒ Issue
Returns a new instance of Issue.
5 6 7 |
# File 'lib/scanny/issue.rb', line 5 def initialize(file, line, impact, , cwe = nil) @file, @line, @impact, @message, @cwe = file, line, impact, , cwe end |
Instance Attribute Details
#cwe ⇒ Object (readonly)
Returns the value of attribute cwe.
3 4 5 |
# File 'lib/scanny/issue.rb', line 3 def cwe @cwe end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
3 4 5 |
# File 'lib/scanny/issue.rb', line 3 def file @file end |
#impact ⇒ Object (readonly)
Returns the value of attribute impact.
3 4 5 |
# File 'lib/scanny/issue.rb', line 3 def impact @impact end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
3 4 5 |
# File 'lib/scanny/issue.rb', line 3 def line @line end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
3 4 5 |
# File 'lib/scanny/issue.rb', line 3 def @message end |
Instance Method Details
#==(other) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/scanny/issue.rb', line 9 def ==(other) other.instance_of?(self.class) && @file == other.file && @line == other.line && @impact == other.impact && @message == other. && @cwe == other.cwe end |
#to_s ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/scanny/issue.rb', line 18 def to_s cwe_suffix = if @cwe " (" + Array(@cwe).map { |cwe| "CWE-#{cwe}" }.join(", ") + ")" else "" end "[#{@impact}] #{@file}:#{@line}: #{@message}#{cwe_suffix}" end |