MCPcopy Create free account
hub / github.com/FastLED/FastLED / collect_input_files

Function collect_input_files

ci/lint_cpp_rs/src/lib.rs:1670–1708  ·  view source on GitHub ↗
(project_root: &Path, inputs: &[String])

Source from the content-addressed store, hash-verified

1668}
1669
1670fn collect_input_files(project_root: &Path, inputs: &[String]) -> Result<Vec<PathBuf>, DynError> {
1671 let mut files = BTreeSet::new();
1672
1673 if inputs.is_empty() {
1674 for dir in ["src", "examples", "tests"] {
1675 let root = project_root.join(dir);
1676 if root.exists() {
1677 collect_directory_files(&root, &mut files);
1678 }
1679 }
1680 } else {
1681 for input in inputs {
1682 let mut input_files = BTreeSet::new();
1683 if input.contains('*') || input.contains('?') || input.contains('[') {
1684 let mut matched = false;
1685 for entry in glob(input)? {
1686 matched = true;
1687 let path = entry?;
1688 collect_path(&path, &mut input_files, false);
1689 }
1690 if !matched || input_files.is_empty() {
1691 return Err(format!("input pattern matched no files: {input}").into());
1692 }
1693 } else {
1694 let path = PathBuf::from(input);
1695 if !path.exists() {
1696 return Err(format!("input path not found: {input}").into());
1697 }
1698 collect_path(&path, &mut input_files, true);
1699 if input_files.is_empty() {
1700 return Err(format!("input path produced no lintable files: {input}").into());
1701 }
1702 }
1703 files.extend(input_files);
1704 }
1705 }
1706
1707 Ok(files.into_iter().collect())
1708}
1709
1710fn collect_path(path: &Path, files: &mut BTreeSet<PathBuf>, allow_any_file: bool) {
1711 if path.is_dir() {

Callers 3

run_cliFunction · 0.85

Calls 4

collect_directory_filesFunction · 0.85
collect_pathFunction · 0.85
is_emptyMethod · 0.45
containsMethod · 0.45