pub fn check_file_ownership(
content: &str,
file_path: &str,
) -> Option<OwnershipResult>Expand description
Find which CODEOWNERS rule owns file_path, parsing content each call.
For hot loops where the same CODEOWNERS content is checked against many
paths, parse once and use check_file_ownership_parsed instead.
Returns None if no rule matches.
ยงExample
use codeowners_parser::check_file_ownership;
let content = "*.rs @rust-team\n/src/main.rs @main-owner\n";
let result = check_file_ownership(content, "src/main.rs").unwrap();
assert_eq!(result.pattern, "/src/main.rs");
assert_eq!(result.owners, vec!["@main-owner"]);