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>
<Bug pattern="FCBL_FIELD_COULD_BE_LOCAL" />
</Match>
<Match>
<Bug pattern="IMC_IMMATURE_CLASS_VAR_NAME" />
</Match>
<Match>
<Bug pattern="CFS_CONFUSING_FUNCTION_SEMANTICS" />
</Match>

View File

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