Class: Finding
- Inherits:
-
Struct
- Object
- Struct
- Finding
- Defined in:
- lib/finding.rb,
lib/finding.rb
Constant Summary collapse
- SEVERITIES =
%i[critical high medium low].freeze
- SEVERITY_ORDER =
SEVERITIES.each_with_index.to_h.freeze
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#file ⇒ Object
Returns the value of attribute file.
-
#fix ⇒ Object
Returns the value of attribute fix.
-
#line ⇒ Object
Returns the value of attribute line.
-
#message ⇒ Object
Returns the value of attribute message.
-
#rule ⇒ Object
Returns the value of attribute rule.
-
#severity ⇒ Object
Returns the value of attribute severity.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #critical? ⇒ Boolean
- #high? ⇒ Boolean
- #low? ⇒ Boolean
- #medium? ⇒ Boolean
- #to_h ⇒ Object
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code
1 2 3 |
# File 'lib/finding.rb', line 1 def code @code end |
#file ⇒ Object
Returns the value of attribute file
1 2 3 |
# File 'lib/finding.rb', line 1 def file @file end |
#fix ⇒ Object
Returns the value of attribute fix
1 2 3 |
# File 'lib/finding.rb', line 1 def fix @fix end |
#line ⇒ Object
Returns the value of attribute line
1 2 3 |
# File 'lib/finding.rb', line 1 def line @line end |
#message ⇒ Object
Returns the value of attribute message
1 2 3 |
# File 'lib/finding.rb', line 1 def @message end |
#rule ⇒ Object
Returns the value of attribute rule
1 2 3 |
# File 'lib/finding.rb', line 1 def rule @rule end |
#severity ⇒ Object
Returns the value of attribute severity
1 2 3 |
# File 'lib/finding.rb', line 1 def severity @severity end |
Instance Method Details
#<=>(other) ⇒ Object
7 8 9 |
# File 'lib/finding.rb', line 7 def <=>(other) (SEVERITY_ORDER[severity] || 99) <=> (SEVERITY_ORDER[other.severity] || 99) end |
#critical? ⇒ Boolean
11 |
# File 'lib/finding.rb', line 11 def critical? = severity == :critical |
#high? ⇒ Boolean
12 |
# File 'lib/finding.rb', line 12 def high? = severity == :high |
#low? ⇒ Boolean
14 |
# File 'lib/finding.rb', line 14 def low? = severity == :low |
#medium? ⇒ Boolean
13 |
# File 'lib/finding.rb', line 13 def medium? = severity == :medium |
#to_h ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/finding.rb', line 16 def to_h { rule: rule, severity: severity.to_s, file: file, line: line, code: code, message: , fix: fix } end |