1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// REQ-0124: shared source-tree walker that honours .gitignore.
//
// Wraps `ignore::WalkBuilder` (ripgrep's walker), so the same
// directories git considers untracked are skipped by req coverage,
// req lint, and req review's marker scans. Previously each walker
// hand-rolled `fs::read_dir` + a hard-coded SKIP_DIRS list, which
// missed project-specific ignore patterns (tmp/, build outputs)
// and produced ghost references in coverage reports.
//
// The visitor receives (path, extension-without-dot) pairs filtered
// by the caller's `exts` list. Files outside the ext list, hidden
// files, and gitignored paths are skipped.
use Path;
/// Walk `root` honouring .gitignore, .ignore, and global git excludes.
/// Calls `visit` once per regular file whose extension matches `exts`
/// (case-sensitive; pass lowercase). When .gitignore parsing fails for
/// any reason, falls back to walking everything (better to over-report
/// than to silently skip).