in src/models/piranha_arguments.rs [368:389]
fn validate(&self) -> Result<(), String> {
let _arg: PiranhaArguments = self.clone();
if _arg.code_snippet().is_empty() && _arg.paths_to_codebase().is_empty() {
return Err(
"Invalid Piranha Argument. Missing `path_to_codebase` or `code_snippet`.
Please specify the `path_to_codebase` or `code_snippet` when creating PiranhaArgument !!!"
.to_string(),
);
}
if !_arg.code_snippet().is_empty() && !_arg.paths_to_codebase().is_empty() {
return Err(
"Invalid Piranha arguments. Please either specify the `path_to_codebase` or the `code_snippet`. Not Both."
.to_string(),
);
}
if self.should_validate {
self
.rule_graph
.analyze_and_panic(&self.input_substitutions());
}
Ok(())
}