isGeneratedFile (src/extraction/generated-detection.ts) — full pattern list ported so future language walkers share it.
(file_path: &str)
| 41 | /// isGeneratedFile (src/extraction/generated-detection.ts) — full pattern list |
| 42 | /// ported so future language walkers share it. |
| 43 | pub fn is_generated_file(file_path: &str) -> bool { |
| 44 | static RES: OnceLock<Vec<Regex>> = OnceLock::new(); |
| 45 | let patterns = RES.get_or_init(|| { |
| 46 | [ |
| 47 | r"\.pb\.go$", |
| 48 | r"\.pulsar\.go$", |
| 49 | r"_grpc\.pb\.go$", |
| 50 | r"_mock\.go$", |
| 51 | r"_mocks\.go$", |
| 52 | r"^mock_[^/]+\.go$", |
| 53 | r"\.generated\.[jt]sx?$", |
| 54 | r"\.gen\.[jt]sx?$", |
| 55 | r"\.pb\.[jt]s$", |
| 56 | r"_pb\.[jt]s$", |
| 57 | r"_grpc_pb\.[jt]s$", |
| 58 | r"\.min\.m?js$", |
| 59 | r"_pb2(_grpc)?\.py$", |
| 60 | r"_pb2\.pyi$", |
| 61 | r"\.pb\.(cc|h)$", |
| 62 | r"\.g\.cs$", |
| 63 | r"Grpc\.cs$", |
| 64 | r"OuterClass\.java$", |
| 65 | r"Grpc\.java$", |
| 66 | r"\.pb\.swift$", |
| 67 | r"\.g\.dart$", |
| 68 | r"\.freezed\.dart$", |
| 69 | r"\.pb\.dart$", |
| 70 | r"\.pbgrpc\.dart$", |
| 71 | r"\.chopper\.dart$", |
| 72 | r"\.generated\.rs$", |
| 73 | ] |
| 74 | .iter() |
| 75 | .map(|p| Regex::new(p).expect("generated pattern")) |
| 76 | .collect() |
| 77 | }); |
| 78 | patterns.iter().any(|p| p.is_match(file_path)) |
| 79 | } |
| 80 | |
| 81 | /// Byte offsets of each line start, for UTF-16 column conversion. |
| 82 | pub fn line_starts(src: &str) -> Vec<usize> { |
no test coverage detected