use crate::types::{PluginInput, PluginOutput};
use super::super::NativePlugin;
use super::check_commodity::CheckCommodityPlugin;
use super::leaf_only::LeafOnlyPlugin;
use super::no_duplicates::NoDuplicatesPlugin;
use super::one_commodity::OneCommodityPlugin;
pub struct PedanticPlugin;
impl NativePlugin for PedanticPlugin {
fn name(&self) -> &'static str {
"pedantic"
}
fn description(&self) -> &'static str {
"Enable all strict validation rules"
}
fn process(&self, input: PluginInput) -> PluginOutput {
let mut all_errors = Vec::new();
let leafonly = LeafOnlyPlugin;
let result = leafonly.process(PluginInput {
directives: input.directives.clone(),
options: input.options.clone(),
config: None,
});
all_errors.extend(result.errors);
let onecommodity = OneCommodityPlugin;
let result = onecommodity.process(PluginInput {
directives: input.directives.clone(),
options: input.options.clone(),
config: None,
});
all_errors.extend(result.errors);
let noduplicates = NoDuplicatesPlugin;
let result = noduplicates.process(PluginInput {
directives: input.directives.clone(),
options: input.options.clone(),
config: None,
});
all_errors.extend(result.errors);
let check_commodity = CheckCommodityPlugin;
let result = check_commodity.process(PluginInput {
directives: input.directives.clone(),
options: input.options.clone(),
config: None,
});
all_errors.extend(result.errors);
PluginOutput {
directives: input.directives,
errors: all_errors,
}
}
}