Class: SemgrepWebApp::Status

Inherits:
Object
  • Object
show all
Defined in:
lib/semgrep_web_app/models/status.rb

Overview

The finding's status as exposed in the UI. Status is a derived property combining information from the finding state and triage_state. The triage_state can be used to override the scan state if the finding is still detected

Constant Summary collapse

STATUS =
[
  # TODO: Write general description for OPEN
  OPEN = 'open'.freeze,

  # TODO: Write general description for FIXED
  FIXED = 'fixed'.freeze,

  # TODO: Write general description for IGNORED
  IGNORED = 'ignored'.freeze,

  # TODO: Write general description for REVIEWING
  REVIEWING = 'reviewing'.freeze,

  # TODO: Write general description for FIXING
  FIXING = 'fixing'.freeze,

  # TODO: Write general description for PROVISIONALLY_IGNORED
  PROVISIONALLY_IGNORED = 'provisionally_ignored'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = OPEN) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/semgrep_web_app/models/status.rb', line 38

def self.from_value(value, default_value = OPEN)
  return default_value if value.nil?

  str = value.to_s.strip

  case str.downcase
  when 'open' then OPEN
  when 'fixed' then FIXED
  when 'ignored' then IGNORED
  when 'reviewing' then REVIEWING
  when 'fixing' then FIXING
  when 'provisionally_ignored' then PROVISIONALLY_IGNORED
  else
    default_value
  end
end

.validate(value) ⇒ Object



32
33
34
35
36
# File 'lib/semgrep_web_app/models/status.rb', line 32

def self.validate(value)
  return false if value.nil?

  STATUS.include?(value)
end