Class: GitLab::SecretDetection::Core::Finding

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/secret_detection/core/finding.rb

Overview

Finding is a data object representing a secret finding identified within a payload

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(payload_id, status, line_number = nil, type = nil, description = nil) ⇒ Finding

Returns a new instance of Finding.



10
11
12
13
14
15
16
# File 'lib/gitlab/secret_detection/core/finding.rb', line 10

def initialize(payload_id, status, line_number = nil, type = nil, description = nil)
  @payload_id = payload_id
  @status = status
  @line_number = line_number
  @type = type
  @description = description
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



8
9
10
# File 'lib/gitlab/secret_detection/core/finding.rb', line 8

def description
  @description
end

#line_numberObject (readonly)

Returns the value of attribute line_number.



8
9
10
# File 'lib/gitlab/secret_detection/core/finding.rb', line 8

def line_number
  @line_number
end

#payload_idObject (readonly)

Returns the value of attribute payload_id.



8
9
10
# File 'lib/gitlab/secret_detection/core/finding.rb', line 8

def payload_id
  @payload_id
end

#statusObject (readonly)

Returns the value of attribute status.



8
9
10
# File 'lib/gitlab/secret_detection/core/finding.rb', line 8

def status
  @status
end

#typeObject (readonly)

Returns the value of attribute type.



8
9
10
# File 'lib/gitlab/secret_detection/core/finding.rb', line 8

def type
  @type
end

Instance Method Details

#==(other) ⇒ Object



18
19
20
# File 'lib/gitlab/secret_detection/core/finding.rb', line 18

def ==(other)
  self.class == other.class && other.state == state
end

#to_hObject



22
23
24
25
26
27
28
29
30
# File 'lib/gitlab/secret_detection/core/finding.rb', line 22

def to_h
  {
    payload_id:,
    status:,
    line_number:,
    type:,
    description:
  }
end