Class: Gitlab::SecretDetection::Core::Status

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

Overview

All the possible statuses emitted by the scan operation

Constant Summary collapse

UNSPECIFIED =

These values must stay in-sync with the GRPC::ScanResponse::Status values

0
FOUND =

to match the GRPC::Status values

1
FOUND_WITH_ERRORS =

When scan operation completes with one or more findings

2
SCAN_TIMEOUT =

When scan operation completes with one or more findings along with some errors

3
PAYLOAD_TIMEOUT =

When the scan operation runs beyond given time out

4
SCAN_ERROR =

When the scan operation on a payload runs beyond given time out

5
INPUT_ERROR =

When the scan operation fails due to regex error

6
NOT_FOUND =

When the scan operation fails due to invalid input

7
AUTH_ERROR =

When scan operation completes with zero findings

8

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.values_mapObject (readonly)

Returns the value of attribute values_map.



24
25
26
# File 'lib/gitlab/secret_detection/core/status.rb', line 24

def values_map
  @values_map
end

Class Method Details

.const_set(name, value) ⇒ Object

Register constants and their values in the map



27
28
29
30
31
# File 'lib/gitlab/secret_detection/core/status.rb', line 27

def const_set(name, value)
  const = super
  @values_map[value] = name
  const
end

.find_by_value(value) ⇒ Object

Look up a constant by its value



34
35
36
37
# File 'lib/gitlab/secret_detection/core/status.rb', line 34

def find_by_value(value)
  const_name = @values_map[value]
  const_name ? const_get(const_name) : nil
end

.name_by_value(value) ⇒ Object

Get the name of a constant by its value



40
41
42
# File 'lib/gitlab/secret_detection/core/status.rb', line 40

def name_by_value(value)
  @values_map[value]
end