Class: SemgrepWebApp::Mode
- Inherits:
-
Object
- Object
- SemgrepWebApp::Mode
- Defined in:
- lib/semgrep_web_app/models/mode.rb
Overview
The behavior of the finding reporting: Monitor / Comment / Block. | value | description | |-------|---------------| | MODE_MONITOR | Monitor mode, silently report findings | | MODE_COMMENT | Comment mode, leaves PR comments but does not block | | MODE_BLOCK | Block mode, leaves PR comments and blocks PR | | MODE_DISABLED | Disabled mode, not active |
Constant Summary collapse
- MODE =
[ # TODO: Write general description for MODE_MONITOR MODE_MONITOR = 'MODE_MONITOR'.freeze, # TODO: Write general description for MODE_COMMENT MODE_COMMENT = 'MODE_COMMENT'.freeze, # TODO: Write general description for MODE_BLOCK MODE_BLOCK = 'MODE_BLOCK'.freeze, # TODO: Write general description for MODE_DISABLED MODE_DISABLED = 'MODE_DISABLED'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = MODE_MONITOR) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/semgrep_web_app/models/mode.rb', line 33 def self.from_value(value, default_value = MODE_MONITOR) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'mode_monitor' then MODE_MONITOR when 'mode_comment' then MODE_COMMENT when 'mode_block' then MODE_BLOCK when 'mode_disabled' then MODE_DISABLED else default_value end end |
.validate(value) ⇒ Object
27 28 29 30 31 |
# File 'lib/semgrep_web_app/models/mode.rb', line 27 def self.validate(value) return false if value.nil? MODE.include?(value) end |