style: include IMC_IMMATURE_CLASS_VAR_NAME (#5197)

This commit is contained in:
Piotr Idzik 2024-06-01 23:36:12 +02:00 committed by GitHub
parent 5e4db7baf1
commit 2e387fe54e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 7 deletions

View File

@ -216,9 +216,6 @@
<Match> <Match>
<Bug pattern="FCBL_FIELD_COULD_BE_LOCAL" /> <Bug pattern="FCBL_FIELD_COULD_BE_LOCAL" />
</Match> </Match>
<Match>
<Bug pattern="IMC_IMMATURE_CLASS_VAR_NAME" />
</Match>
<Match> <Match>
<Bug pattern="CFS_CONFUSING_FUNCTION_SEMANTICS" /> <Bug pattern="CFS_CONFUSING_FUNCTION_SEMANTICS" />
</Match> </Match>

View File

@ -5,16 +5,16 @@ public final class StandardDeviation {
} }
public static double stdDev(double[] data) { public static double stdDev(double[] data) {
double var = 0; double variance = 0;
double avg = 0; double avg = 0;
for (int i = 0; i < data.length; i++) { for (int i = 0; i < data.length; i++) {
avg += data[i]; avg += data[i];
} }
avg /= data.length; avg /= data.length;
for (int j = 0; j < data.length; j++) { for (int j = 0; j < data.length; j++) {
var += Math.pow((data[j] - avg), 2); variance += Math.pow((data[j] - avg), 2);
} }
var /= data.length; variance /= data.length;
return Math.sqrt(var); return Math.sqrt(variance);
} }
} }