Class: SemgrepWebApp::PolicyMode3
- Inherits:
-
Object
- Object
- SemgrepWebApp::PolicyMode3
- Defined in:
- lib/semgrep_web_app/models/policy_mode3.rb
Overview
New policy mode to set for the Rule. - 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 | 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
- POLICY_MODE3 =
[ # 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
36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/semgrep_web_app/models/policy_mode3.rb', line 36 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
30 31 32 33 34 |
# File 'lib/semgrep_web_app/models/policy_mode3.rb', line 30 def self.validate(value) return false if value.nil? POLICY_MODE3.include?(value) end |