in src/models/piranha_arguments.rs [200:261]
fn py_new(
language: String, paths_to_codebase: Option<Vec<String>>, include: Option<Vec<String>>,
exclude: Option<Vec<String>>, substitutions: Option<&PyDict>,
path_to_configurations: Option<String>, rule_graph: Option<RuleGraph>,
code_snippet: Option<String>, dry_run: Option<bool>, cleanup_comments: Option<bool>,
cleanup_comments_buffer: Option<i32>, number_of_ancestors_in_parent_scope: Option<u8>,
delete_consecutive_new_lines: Option<bool>, global_tag_prefix: Option<String>,
delete_file_if_empty: Option<bool>, path_to_output_summary: Option<String>,
allow_dirty_ast: Option<bool>, should_validate: Option<bool>, experiment_dyn: Option<bool>,
path_to_custom_builtin_rules: Option<String>,
) -> Self {
let subs = substitutions.map_or(vec![], |s| {
s.iter()
.map(|(k, v)| (k.to_string(), v.to_string()))
.collect_vec()
});
let rg = rule_graph.unwrap_or_else(|| RuleGraphBuilder::default().build());
PiranhaArgumentsBuilder::default()
.paths_to_codebase(paths_to_codebase.unwrap_or_else(default_paths_to_codebase))
.include(
include
.unwrap_or_default()
.iter()
.map(|x| Pattern::new(x).unwrap())
.collect_vec(),
)
.exclude(
exclude
.unwrap_or_default()
.iter()
.map(|x| Pattern::new(x).unwrap())
.collect_vec(),
)
.path_to_configurations(path_to_configurations.unwrap_or_else(default_path_to_configurations))
.rule_graph(rg)
.code_snippet(code_snippet.unwrap_or_else(default_code_snippet))
.language(PiranhaLanguage::from(language.as_str()))
.substitutions(subs)
.dry_run(dry_run.unwrap_or_else(default_dry_run))
.cleanup_comments(cleanup_comments.unwrap_or_else(default_cleanup_comments))
.cleanup_comments_buffer(
cleanup_comments_buffer.unwrap_or_else(default_cleanup_comments_buffer),
)
.number_of_ancestors_in_parent_scope(
number_of_ancestors_in_parent_scope
.unwrap_or_else(default_number_of_ancestors_in_parent_scope),
)
.delete_consecutive_new_lines(
delete_consecutive_new_lines.unwrap_or_else(default_delete_consecutive_new_lines),
)
.global_tag_prefix(global_tag_prefix.unwrap_or_else(default_global_tag_prefix))
.delete_file_if_empty(delete_file_if_empty.unwrap_or_else(default_delete_file_if_empty))
.path_to_output_summary(path_to_output_summary)
.allow_dirty_ast(allow_dirty_ast.unwrap_or_else(default_allow_dirty_ast))
.should_validate(should_validate.unwrap_or_else(default_graph_validation))
.experiment_dyn(experiment_dyn.unwrap_or_else(default_experiment_dyn))
.path_to_custom_builtin_rules(
path_to_custom_builtin_rules.unwrap_or_else(default_path_to_custom_builtin_rules),
)
.build()
}