From 7c21e1419f658e09173f7c82d2a27e6850d781f7 Mon Sep 17 00:00:00 2001 From: giovannitangredi Date: Fri, 4 Mar 2022 11:19:11 +0100 Subject: [PATCH] Do not export internal metric functions as public --- src/metrics/cognitive.rs | 2 +- src/metrics/cyclomatic.rs | 3 +-- src/metrics/exit.rs | 2 +- src/metrics/nargs.rs | 2 +- src/metrics/nom.rs | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/metrics/cognitive.rs b/src/metrics/cognitive.rs index 3c20c1611..81f97b975 100644 --- a/src/metrics/cognitive.rs +++ b/src/metrics/cognitive.rs @@ -102,7 +102,7 @@ impl Stats { pub fn cognitive_average(&self) -> f64 { self.cognitive_sum() / self.total_space_functions as f64 } - pub fn compute_minmax(&mut self) { + pub(crate) fn compute_minmax(&mut self) { self.structural_min = self.structural_min.min(self.structural); self.structural_max = self.structural_max.max(self.structural); self.structural_sum += self.structural; diff --git a/src/metrics/cyclomatic.rs b/src/metrics/cyclomatic.rs index 79f776e1b..83e3af166 100644 --- a/src/metrics/cyclomatic.rs +++ b/src/metrics/cyclomatic.rs @@ -89,8 +89,7 @@ impl Stats { pub fn cyclomatic_min(&self) -> f64 { self.cyclomatic_min } - /// Last step for computing minimum and maximum value and update cyclomatic_sum - pub fn compute_minmax(&mut self) { + pub(crate) fn compute_minmax(&mut self) { self.cyclomatic_max = self.cyclomatic_max.max(self.cyclomatic); self.cyclomatic_min = self.cyclomatic_min.min(self.cyclomatic); self.cyclomatic_sum += self.cyclomatic; diff --git a/src/metrics/exit.rs b/src/metrics/exit.rs index aa4afc76e..b85c7851c 100644 --- a/src/metrics/exit.rs +++ b/src/metrics/exit.rs @@ -91,7 +91,7 @@ impl Stats { pub fn exit_average(&self) -> f64 { self.exit_sum() / self.total_space_functions as f64 } - pub fn compute_minmax(&mut self) { + pub(crate) fn compute_minmax(&mut self) { self.exit_max = self.exit_max.max(self.exit); self.exit_min = self.exit_min.min(self.exit); self.exit_sum += self.exit; diff --git a/src/metrics/nargs.rs b/src/metrics/nargs.rs index 72e1d79d7..99070b763 100644 --- a/src/metrics/nargs.rs +++ b/src/metrics/nargs.rs @@ -162,7 +162,7 @@ impl Stats { self.closure_nargs_max as f64 } - pub fn compute_minmax(&mut self) { + pub(crate) fn compute_minmax(&mut self) { self.closure_nargs_min = self.closure_nargs_min.min(self.closure_nargs); self.closure_nargs_max = self.closure_nargs_max.max(self.closure_nargs); self.fn_nargs_min = self.fn_nargs_min.min(self.fn_nargs); diff --git a/src/metrics/nom.rs b/src/metrics/nom.rs index 7046ce135..321c5cc60 100644 --- a/src/metrics/nom.rs +++ b/src/metrics/nom.rs @@ -168,7 +168,7 @@ impl Stats { pub fn total(&self) -> f64 { self.functions_sum() + self.closures_sum() } - pub fn compute_minmax(&mut self) { + pub(crate) fn compute_minmax(&mut self) { self.functions_min = self.functions_min.min(self.functions); self.functions_max = self.functions_max.max(self.functions); self.closures_min = self.closures_min.min(self.closures);