aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@gmail.com>2012-12-05 15:46:51 +0100
committerJulien Lancelot <julien.lancelot@gmail.com>2012-12-05 15:47:44 +0100
commit53df3f4abb20e16ba8439991e01562a677cce75e (patch)
tree1fb147ff1cb08bda71ccdebb6b2da019ab25ca40 /sonar-batch
parent9c573f1b661e4a7c75c086c2aa376dcd436dd48b (diff)
downloadsonarqube-53df3f4abb20e16ba8439991e01562a677cce75e.tar.gz
sonarqube-53df3f4abb20e16ba8439991e01562a677cce75e.zip
Fix some quality flaws
Diffstat (limited to 'sonar-batch')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/bootstrap/DurationLabel.java42
1 files changed, 21 insertions, 21 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/DurationLabel.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/DurationLabel.java
index e04109ead9d..28596dd5e03 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/DurationLabel.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/DurationLabel.java
@@ -40,32 +40,32 @@ public class DurationLabel {
private String years = "{0} years";
public String label(long durationInMillis) {
- double seconds = durationInMillis / 1000.0;
- double minutes = seconds / 60;
- double hours = minutes / 60;
- double days = hours / 24;
- double years = days / 365;
-
- String time = MessageFormat.format(this.years, Math.floor(years));
- if (seconds < 45) {
+ double nbSeconds = durationInMillis / 1000.0;
+ double nbMinutes = nbSeconds / 60;
+ double nbHours = nbMinutes / 60;
+ double nbDays = nbHours / 24;
+ double nbYears = nbDays / 365;
+
+ String time = MessageFormat.format(this.years, Math.floor(nbYears));
+ if (nbSeconds < 45) {
time = this.seconds;
- } else if (seconds < 90) {
+ } else if (nbSeconds < 90) {
time = this.minute;
- } else if (minutes < 45) {
- time = MessageFormat.format(this.minutes, Math.round(minutes));
- } else if (minutes < 90) {
+ } else if (nbMinutes < 45) {
+ time = MessageFormat.format(this.minutes, Math.round(nbMinutes));
+ } else if (nbMinutes < 90) {
time = this.hour;
- } else if (hours < 24) {
- time = MessageFormat.format(this.hours, Math.round(hours));
- } else if (hours < 48) {
+ } else if (nbHours < 24) {
+ time = MessageFormat.format(this.hours, Math.round(nbHours));
+ } else if (nbHours < 48) {
time = this.day;
- } else if (days < 30) {
- time = MessageFormat.format(this.days, Math.floor(days));
- } else if (days < 60) {
+ } else if (nbDays < 30) {
+ time = MessageFormat.format(this.days, Math.floor(nbDays));
+ } else if (nbDays < 60) {
time = this.month;
- } else if (days < 365) {
- time = MessageFormat.format(this.months, Math.floor(days / 30));
- } else if (years < 2) {
+ } else if (nbDays < 365) {
+ time = MessageFormat.format(this.months, Math.floor(nbDays / 30));
+ } else if (nbYears < 2) {
time = this.year;
}