Class: SemgrepWebApp::Statuses
- Inherits:
-
Object
- Object
- SemgrepWebApp::Statuses
- Defined in:
- lib/semgrep_web_app/models/statuses.rb
Overview
Only get scans that have one of these statuses | value | description | |-------|---------------| | SCAN_STATUS_RUNNING | The scan is currently running | | SCAN_STATUS_COMPLETED | The scan has completed successfully (0 or 1 exit code) | | SCAN_STATUS_PENDING | The scan is queued and waiting to start | | SCAN_STATUS_CANCELLED | The scan was cancelled before completion | | SCAN_STATUS_ERROR | The scan has exited with a failure (exit code not 0 or
- | | SCAN_STATUS_NEVER_FINISHED | The scan did not report an error or
success after over an hour |
Constant Summary collapse
- STATUSES =
[ # TODO: Write general description for SCAN_STATUS_UNSPECIFIED SCAN_STATUS_UNSPECIFIED = 'SCAN_STATUS_UNSPECIFIED'.freeze, # TODO: Write general description for SCAN_STATUS_RUNNING SCAN_STATUS_RUNNING = 'SCAN_STATUS_RUNNING'.freeze, # TODO: Write general description for SCAN_STATUS_COMPLETED SCAN_STATUS_COMPLETED = 'SCAN_STATUS_COMPLETED'.freeze, # TODO: Write general description for SCAN_STATUS_PENDING SCAN_STATUS_PENDING = 'SCAN_STATUS_PENDING'.freeze, # TODO: Write general description for SCAN_STATUS_CANCELLED SCAN_STATUS_CANCELLED = 'SCAN_STATUS_CANCELLED'.freeze, # TODO: Write general description for SCAN_STATUS_ERROR SCAN_STATUS_ERROR = 'SCAN_STATUS_ERROR'.freeze, # TODO: Write general description for SCAN_STATUS_NEVER_FINISHED SCAN_STATUS_NEVER_FINISHED = 'SCAN_STATUS_NEVER_FINISHED'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = SCAN_STATUS_UNSPECIFIED) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/semgrep_web_app/models/statuses.rb', line 45 def self.from_value(value, default_value = SCAN_STATUS_UNSPECIFIED) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'scan_status_unspecified' then SCAN_STATUS_UNSPECIFIED when 'scan_status_running' then SCAN_STATUS_RUNNING when 'scan_status_completed' then SCAN_STATUS_COMPLETED when 'scan_status_pending' then SCAN_STATUS_PENDING when 'scan_status_cancelled' then SCAN_STATUS_CANCELLED when 'scan_status_error' then SCAN_STATUS_ERROR when 'scan_status_never_finished' then SCAN_STATUS_NEVER_FINISHED else default_value end end |
.validate(value) ⇒ Object
39 40 41 42 43 |
# File 'lib/semgrep_web_app/models/statuses.rb', line 39 def self.validate(value) return false if value.nil? STATUSES.include?(value) end |