Class: SecureKeys::Validation::Finding
- Inherits:
-
Object
- Object
- SecureKeys::Validation::Finding
- Defined in:
- lib/validation/models/finding.rb
Overview
Represents a single secret detected during a file or git diff scan
Instance Attribute Summary collapse
-
#column ⇒ Object
readonly
Returns the value of attribute column.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#full_line ⇒ Object
readonly
Returns the value of attribute full_line.
-
#is_addition ⇒ Object
readonly
Returns the value of attribute is_addition.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#matched_text ⇒ Object
readonly
Returns the value of attribute matched_text.
-
#severity ⇒ Object
readonly
Returns the value of attribute severity.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#addition? ⇒ Boolean
Check if this finding came from a git diff addition.
-
#initialize(file:, line:, column:, type:, description:, severity:, matched_text:, full_line:, is_addition: false) ⇒ Finding
constructor
Initialize a new finding.
-
#to_h ⇒ Hash
Returns a hash representation of the finding.
-
#to_s ⇒ String
Returns a one-line string representation of the finding.
Constructor Details
#initialize(file:, line:, column:, type:, description:, severity:, matched_text:, full_line:, is_addition: false) ⇒ Finding
Initialize a new finding
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/validation/models/finding.rb', line 20 def initialize(file:, line:, column:, type:, description:, severity:, matched_text:, full_line:, is_addition: false) @file = file @line = line @column = column @type = type @description = description @severity = severity @matched_text = matched_text @full_line = full_line @is_addition = is_addition end |
Instance Attribute Details
#column ⇒ Object (readonly)
Returns the value of attribute column.
7 8 9 |
# File 'lib/validation/models/finding.rb', line 7 def column @column end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
7 8 9 |
# File 'lib/validation/models/finding.rb', line 7 def description @description end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
7 8 9 |
# File 'lib/validation/models/finding.rb', line 7 def file @file end |
#full_line ⇒ Object (readonly)
Returns the value of attribute full_line.
7 8 9 |
# File 'lib/validation/models/finding.rb', line 7 def full_line @full_line end |
#is_addition ⇒ Object (readonly)
Returns the value of attribute is_addition.
7 8 9 |
# File 'lib/validation/models/finding.rb', line 7 def is_addition @is_addition end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
7 8 9 |
# File 'lib/validation/models/finding.rb', line 7 def line @line end |
#matched_text ⇒ Object (readonly)
Returns the value of attribute matched_text.
7 8 9 |
# File 'lib/validation/models/finding.rb', line 7 def matched_text @matched_text end |
#severity ⇒ Object (readonly)
Returns the value of attribute severity.
7 8 9 |
# File 'lib/validation/models/finding.rb', line 7 def severity @severity end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
7 8 9 |
# File 'lib/validation/models/finding.rb', line 7 def type @type end |
Instance Method Details
#addition? ⇒ Boolean
Check if this finding came from a git diff addition
35 36 37 |
# File 'lib/validation/models/finding.rb', line 35 def addition? is_addition end |
#to_h ⇒ Hash
Returns a hash representation of the finding
47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/validation/models/finding.rb', line 47 def to_h { file:, line:, column:, type:, description:, severity:, matched_text:, full_line:, is_addition:, } end |
#to_s ⇒ String
Returns a one-line string representation of the finding
41 42 43 |
# File 'lib/validation/models/finding.rb', line 41 def to_s "#{severity_icon} #{file}:#{line}:#{column} [#{type}] #{description} — #{matched_text}" end |