MCPcopy Create free account
hub / github.com/KingOfBugbounty/enumrust / analyze_context

Function analyze_context

src/secret_validators.rs:192–210  ·  view source on GitHub ↗
(content: &str, match_position: usize)

Source from the content-addressed store, hash-verified

190/// Analyze the context of a matched secret
191#[allow(dead_code)]
192pub fn analyze_context(content: &str, match_position: usize) -> CodeContext {
193 // Priority 1: Check if in comment
194 if is_in_comment(content, match_position) {
195 return CodeContext::Comment;
196 }
197
198 // Priority 2: Check if test code
199 if is_test_code(content, match_position) {
200 return CodeContext::TestCode;
201 }
202
203 // Priority 3: Check if example/documentation
204 if has_example_indicators(content, match_position) {
205 return CodeContext::Example;
206 }
207
208 // Default: Assume real code
209 CodeContext::RealCode
210}
211
212// ═══════════════════════════════════════════════════════════════════
213// PLACEHOLDER DETECTION

Callers 1

score_secretFunction · 0.85

Calls 3

is_in_commentFunction · 0.85
is_test_codeFunction · 0.85
has_example_indicatorsFunction · 0.85

Tested by

no test coverage detected