Class: SemgrepWebApp::Reachability
- Inherits:
-
Object
- Object
- SemgrepWebApp::Reachability
- Defined in:
- lib/semgrep_web_app/models/reachability.rb
Overview
Indicates whether the vulnerable code is reachable
Constant Summary collapse
- REACHABILITY =
[ # TODO: Write general description for ENUM_NO_REACHABILITY_ANALYSIS ENUM_NO_REACHABILITY_ANALYSIS = 'no reachability analysis'.freeze, # TODO: Write general description for REACHABLE REACHABLE = 'reachable'.freeze, # TODO: Write general description for ENUM_ALWAYS_REACHABLE ENUM_ALWAYS_REACHABLE = 'always reachable'.freeze, # TODO: Write general description for ENUM_CONDITIONALLY_REACHABLE ENUM_CONDITIONALLY_REACHABLE = 'conditionally reachable'.freeze, # TODO: Write general description for UNREACHABLE UNREACHABLE = 'unreachable'.freeze ].freeze
Class Method Summary collapse
- .from_value(value, default_value = ENUM_NO_REACHABILITY_ANALYSIS) ⇒ Object
- .validate(value) ⇒ Object
Class Method Details
.from_value(value, default_value = ENUM_NO_REACHABILITY_ANALYSIS) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/semgrep_web_app/models/reachability.rb', line 32 def self.from_value(value, default_value = ENUM_NO_REACHABILITY_ANALYSIS) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'enum_no_reachability_analysis' then ENUM_NO_REACHABILITY_ANALYSIS when 'reachable' then REACHABLE when 'enum_always_reachable' then ENUM_ALWAYS_REACHABLE when 'enum_conditionally_reachable' then ENUM_CONDITIONALLY_REACHABLE when 'unreachable' then UNREACHABLE else default_value end end |
.validate(value) ⇒ Object
26 27 28 29 30 |
# File 'lib/semgrep_web_app/models/reachability.rb', line 26 def self.validate(value) return false if value.nil? REACHABILITY.include?(value) end |