Validate CLI target selectors against the current scan universe. Returns: matched_paths: repo-relative file paths matched by any selector unmatched_targets: raw target strings that matched nothing
(
repo_root: Path,
cfg: ToolConfig,
targets: list[str] | None,
)
| 340 | |
| 341 | |
| 342 | def validate_requested_targets( |
| 343 | repo_root: Path, |
| 344 | cfg: ToolConfig, |
| 345 | targets: list[str] | None, |
| 346 | ) -> tuple[list[str], list[str]]: |
| 347 | """ |
| 348 | Validate CLI target selectors against the current scan universe. |
| 349 | |
| 350 | Returns: |
| 351 | matched_paths: repo-relative file paths matched by any selector |
| 352 | unmatched_targets: raw target strings that matched nothing |
| 353 | """ |
| 354 | if not targets: |
| 355 | return [], [] |
| 356 | |
| 357 | specs = compile_target_specs(targets, repo_root) |
| 358 | candidates = iter_scan_candidate_paths(repo_root, cfg) |
| 359 | |
| 360 | matched_paths = sorted({rel for rel in candidates if target_matches(rel, specs)}) |
| 361 | |
| 362 | unmatched_targets: list[str] = [] |
| 363 | for spec in specs or []: |
| 364 | if spec["kind"] == "invalid": |
| 365 | unmatched_targets.append(spec["raw"]) |
| 366 | elif not any(target_spec_matches_path(rel, spec) for rel in candidates): |
| 367 | unmatched_targets.append(spec["raw"]) |
| 368 | |
| 369 | return matched_paths, unmatched_targets |
| 370 | |
| 371 | |
| 372 | def print_target_match_summary(matched_paths: list[str], requested_targets: list[str] | None) -> None: |
no test coverage detected