Skip to content

Commit 8da2cb4

Browse files
committed
wip: move parser functions to parser.rs
1 parent 642de81 commit 8da2cb4

File tree

7 files changed

+393
-357
lines changed

7 files changed

+393
-357
lines changed

src/core/cache.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ pub fn build_cache(
1616
let mut owners_map = std::collections::HashMap::new();
1717
let mut tags_map = std::collections::HashMap::new();
1818

19+
println!("start building cache");
20+
1921
// Process each file to find owners and tags
2022
for file_path in files {
2123
let owners = find_owners_for_file(&file_path, &entries)?;
@@ -27,9 +29,12 @@ pub fn build_cache(
2729
owners: owners.clone(),
2830
tags: tags.clone(),
2931
};
32+
dbg!(&file_entry);
3033
file_entries.push(file_entry);
3134
}
3235

36+
println!("file entry done");
37+
3338
// Process each owner
3439
let owners = collect_owners(&entries);
3540
owners.iter().for_each(|owner| {
@@ -41,6 +46,8 @@ pub fn build_cache(
4146
}
4247
});
4348

49+
println!("owner done");
50+
4451
// Process each tag
4552
let tags = collect_tags(&entries);
4653
tags.iter().for_each(|tag| {
@@ -52,6 +59,8 @@ pub fn build_cache(
5259
}
5360
});
5461

62+
println!("tag done");
63+
5564
Ok(CodeownersCache {
5665
hash,
5766
entries,

src/core/commands.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,34 @@ pub fn codeowners_parse(
3232
// Collect all CODEOWNERS files in the specified path
3333
let codeowners_files = super::common::find_codeowners_files(path)?;
3434

35+
println!("collected codeowners files");
36+
3537
// Parse each CODEOWNERS file and collect entries
3638
let parsed_codeowners: Vec<CodeownersEntry> = codeowners_files
3739
.iter()
3840
.filter_map(|file| {
39-
let parsed = super::common::parse_codeowners(file).ok()?;
41+
let parsed = super::parser::parse_codeowners(file).ok()?;
4042
Some(parsed)
4143
})
4244
.flatten()
4345
.collect();
4446

47+
println!("collected entries");
48+
4549
// Collect all files in the specified path
4650
let files = find_files(path)?;
4751

52+
println!("find files");
53+
4854
// Build the cache from the parsed CODEOWNERS entries and the files
4955
let hash = get_repo_hash(path)?;
56+
57+
println!("repository hash: {:?}", hash);
58+
5059
let cache = build_cache(parsed_codeowners, files, hash)?;
5160

61+
println!("built cache");
62+
5263
// Store the cache in the specified file
5364
store_cache(&cache, &cache_file, encoding)?;
5465

0 commit comments

Comments
 (0)