Skip to content
Merged
17 changes: 10 additions & 7 deletions crates/cli/src/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use codeint_plugin_host::{
PluginHostError, WasmLanguagePlugin, WasmMetricPlugin, load_language_plugins_with_limits,
load_metric_plugins_with_limits,
};
use codeint_report::{LanguageSchema, MeasuredLanguage, OwnershipOptions, Report};
use codeint_report::{LanguageSchema, MeasuredLanguage, OwnershipOptions, Report, ReportOptions};
use rayon::prelude::{IntoParallelIterator, IntoParallelRefIterator, ParallelIterator};

#[cfg(test)]
Expand Down Expand Up @@ -405,14 +405,17 @@ fn check_loaded(
let selected = select_workspace_package(&workspace, requested)?;
filter_languages_to_package(&mut languages, &selected);
}
Ok(Report::summarize_with_ownership(
Ok(Report::summarize_with_options(
languages,
tree.submodules().to_vec(),
findings,
&configuration.budgets,
metric_plugins,
configuration.boundaries.as_ref(),
ownership,
ReportOptions {
findings,
budgets: &configuration.budgets,
metric_plugins,
boundaries: configuration.boundaries.as_ref(),
duplication: configuration.duplication,
ownership,
},
)?)
}

Expand Down
9 changes: 7 additions & 2 deletions crates/cli/src/commit_measurement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ use crate::check::{
use crate::describe;

const CODEINT_VERSION: &str = env!("CARGO_PKG_VERSION");
const MEASUREMENT_CACHE_VERSION: u32 = 2;

#[derive(Serialize)]
struct MeasurementSettings<'configuration> {
codeint_version: &'static str,
cache_version: u32,
language_plugins: Vec<PluginIdentity>,
configuration: &'configuration Configuration,
#[serde(skip_serializing_if = "Option::is_none")]
Expand Down Expand Up @@ -71,6 +73,7 @@ impl<'run> CommitMeasurer<'run> {
plugins,
settings: MeasurementSettings {
codeint_version: CODEINT_VERSION,
cache_version: MEASUREMENT_CACHE_VERSION,
language_plugins,
configuration,
package,
Expand Down Expand Up @@ -137,10 +140,11 @@ pub(crate) fn measure_all_languages_for_package(
} else {
None
};
let measurement = CommitMeasurement::of_with_metrics_and_boundaries(
let measurement = CommitMeasurement::of_with_config(
model,
&metric_plugins,
configuration.boundaries.as_ref(),
configuration.duplication,
)?;
Ok((selected, measurement))
}
Expand All @@ -158,9 +162,10 @@ fn measure_all_languages_selected(
if let Some(selected) = selected {
filter_model_to_package(&mut model, selected);
}
Ok(CommitMeasurement::of_with_metrics_and_boundaries(
Ok(CommitMeasurement::of_with_config(
model,
&metric_plugins,
configuration.boundaries.as_ref(),
configuration.duplication,
)?)
}
13 changes: 13 additions & 0 deletions crates/cli/src/remedy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,11 @@ fn json_shape_remedy(error: &ConfigurationFileError) -> Option<&'static str> {
OutOfRange {
minimum, maximum, ..
} => out_of_range_remedy(*minimum, *maximum),
OutOfExclusiveMinRange {
exclusive_minimum,
maximum,
..
} => out_of_exclusive_min_range_remedy(*exclusive_minimum, *maximum),
NotOneOf { .. } => {
"Set the value to one of the allowed values; the JSON schema that $schema links to describes each one."
}
Expand All @@ -305,6 +310,14 @@ fn out_of_range_remedy(minimum: f64, maximum: f64) -> &'static str {
}
}

fn out_of_exclusive_min_range_remedy(exclusive_minimum: f64, maximum: f64) -> &'static str {
if exclusive_minimum == 0.0 && maximum == 1.0 {
"Set the value to a ratio greater than 0 and at most 1, such as 0.85."
} else {
"Set the value within the allowed range; the JSON schema that $schema links to describes every key."
}
}

fn boundary_config_remedy(error: &ConfigurationFileError) -> Option<&'static str> {
use ConfigurationFileError::*;
match error {
Expand Down
Loading