| 165 | /// Detect if content contains example/documentation indicators |
| 166 | #[allow(dead_code)] |
| 167 | pub fn has_example_indicators(content: &str, position: usize) -> bool { |
| 168 | let example_indicators = [ |
| 169 | "example", "Example", "EXAMPLE", |
| 170 | "sample", "Sample", "SAMPLE", |
| 171 | "demo", "Demo", "DEMO", |
| 172 | "placeholder", "Placeholder", "PLACEHOLDER", |
| 173 | "TODO:", "FIXME:", "NOTE:", "HACK:", |
| 174 | "Replace with", "Change this", "Insert your", |
| 175 | "your-", "my-", "our-", |
| 176 | "documentation", "README", "docs/", |
| 177 | "<your", "<my", "{{", "}}", "${", |
| 178 | ]; |
| 179 | |
| 180 | // Check within 250 chars before and after |
| 181 | let start = position.saturating_sub(250); |
| 182 | let end = (position + 250).min(content.len()); |
| 183 | let nearby_content = &content[start..end]; |
| 184 | |
| 185 | example_indicators.iter().any(|indicator| { |
| 186 | nearby_content.contains(indicator) |
| 187 | }) |
| 188 | } |
| 189 | |
| 190 | /// Analyze the context of a matched secret |
| 191 | #[allow(dead_code)] |