in src/models/piranha_arguments.rs [340:365]
fn get_rule_graph(_arg: &PiranhaArguments) -> RuleGraph {
// Get the built-in rule -graph for the language
let built_in_rules = if !_arg.path_to_custom_builtin_rules().is_empty() {
read_user_config_files(_arg.path_to_custom_builtin_rules())
} else {
let piranha_language = _arg.language();
RuleGraphBuilder::default()
.edges(piranha_language.edges().clone().unwrap_or_default().edges)
.rules(piranha_language.rules().clone().unwrap_or_default().rules)
.build()
};
// TODO: Move to `PiranhaArgumentBuilder`'s _validate - https://github.com/uber/piranha/issues/387
// Get the user-defined rule graph (if any) via the Python/Rust API
let mut user_defined_rules: RuleGraph = _arg.rule_graph().clone();
// In the scenario when rules/edges are passed as toml files
if !_arg.path_to_configurations().is_empty() {
user_defined_rules = read_user_config_files(_arg.path_to_configurations());
}
if user_defined_rules.graph().is_empty() {
warn!("NO RULES PROVIDED. Please provide rules via the RuleGraph API or as toml files");
}
built_in_rules.merge(&user_defined_rules)
}