MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / discover_files

Function discover_files

scripts/update_license_headers.py:172–202  ·  view source on GitHub ↗

Walk the repo and return all files that should have headers.

(root: Path)

Source from the content-addressed store, hash-verified

170
171
172def discover_files(root: Path) -> list[Path]:
173 """Walk the repo and return all files that should have headers."""
174 results = []
175
176 git_files = git_candidate_files(root)
177 if git_files is not None:
178 for rel in git_files:
179 path = root / rel
180 if not path.is_file():
181 continue
182 if is_excluded(rel):
183 continue
184 if get_comment_style(rel) is not None:
185 results.append(path)
186 return sorted(results)
187
188 for dirpath, dirnames, filenames in os.walk(root):
189 rel_dir = Path(dirpath).relative_to(root)
190
191 # Prune excluded directories (modifying dirnames in-place).
192 dirnames[:] = [d for d in dirnames if not is_excluded(rel_dir / d)]
193
194 for fname in filenames:
195 fpath = Path(dirpath) / fname
196 rel = fpath.relative_to(root)
197 if is_excluded(rel):
198 continue
199 if get_comment_style(rel) is not None:
200 results.append(fpath)
201
202 return sorted(results)
203
204
205# ---------------------------------------------------------------------------

Callers 1

mainFunction · 0.85

Calls 3

git_candidate_filesFunction · 0.85
is_excludedFunction · 0.85
get_comment_styleFunction · 0.85

Tested by

no test coverage detected