Skip to content
This repository has been archived by the owner on Apr 6, 2022. It is now read-only.

Commit

Permalink
[Fixed JENKINS-12424] Added messages for one warning.
Browse files Browse the repository at this point in the history
  • Loading branch information
uhafner committed May 14, 2012
1 parent b72cda9 commit 5c21e80
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 24 deletions.
Expand Up @@ -205,38 +205,71 @@ private boolean checkThresholds(final StringBuilder logger, final int annotation
if (isAnnotationCountExceeded(annotationCount, threshold)) {
int delta = annotationCount - convert(threshold);
if (isTotals) {
if (priorities.length == 1) {
Priority priority = priorities[0];
logger.append(Messages.BuildResultEvaluator_unstable_all_priority(
annotationCount, threshold, delta,
priorities[0].getLongLocalizedString(),
url, getPriorityUrl(priority)));
}
else {
logger.append(Messages.BuildResultEvaluator_unstable_all(annotationCount,
threshold, delta, url));
}
createAllMessage(logger, annotationCount, threshold, delta, priorities);
}
else {
String newUrl = url + "/new";
if (priorities.length == 1) {
Priority priority = priorities[0];
logger.append(Messages.BuildResultEvaluator_unstable_new_priority(
annotationCount, threshold, delta,
priorities[0].getLongLocalizedString(),
newUrl, getPriorityUrl(priority)));
}
else {
logger.append(Messages.BuildResultEvaluator_unstable_new(annotationCount,
threshold, delta, newUrl));
}

createNewMessage(logger, annotationCount, threshold, delta, priorities);
}
return true;
}
return false;
}

private void createNewMessage(final StringBuilder logger, final int annotationCount,
final String threshold, final int delta, final Priority... priorities) {
String newUrl = url + "/new";
if (priorities.length == 1) {
Priority priority = priorities[0];
if (annotationCount == 1) {
logger.append(Messages.BuildResultEvaluator_unstable_one_new_priority(threshold, delta,
priorities[0].getLongLocalizedString(),
newUrl, getPriorityUrl(priority)));
}
else {
logger.append(Messages.BuildResultEvaluator_unstable_new_priority(
annotationCount, threshold, delta,
priorities[0].getLongLocalizedString(),
newUrl, getPriorityUrl(priority)));
}
}
else {
if (annotationCount == 1) {
logger.append(Messages.BuildResultEvaluator_unstable_one_new(threshold, delta, newUrl));
}
else {
logger.append(Messages.BuildResultEvaluator_unstable_new(annotationCount,
threshold, delta, newUrl));
}
}
}

private void createAllMessage(final StringBuilder logger, final int annotationCount,
final String threshold, final int delta, final Priority... priorities) {
if (priorities.length == 1) {
Priority priority = priorities[0];
if (annotationCount == 1) {
logger.append(Messages.BuildResultEvaluator_unstable_one_all_priority(
threshold, delta, priorities[0].getLongLocalizedString(), url,
getPriorityUrl(priority)));
}
else {
logger.append(Messages.BuildResultEvaluator_unstable_all_priority(annotationCount,
threshold, delta, priorities[0].getLongLocalizedString(), url,
getPriorityUrl(priority)));
}
}
else {
if (annotationCount == 1) {
logger.append(Messages.BuildResultEvaluator_unstable_one_all(
threshold, delta, url));
}
else {
logger.append(Messages.BuildResultEvaluator_unstable_all(annotationCount,
threshold, delta, url));
}
}
}

private String getPriorityUrl(final Priority priority) {
return url + "/" + priority.name();
}
Expand Down
Expand Up @@ -84,7 +84,11 @@ ResultAction.MultipleFiles=from {0} analyses.
BuildResultEvaluator.success=no threshold has been exceeded

BuildResultEvaluator.unstable.new.priority=<a href="{4}">{0} new warnings</a> of <a href="{5}">priority {3}</a> exceed the threshold of {1} by {2}
BuildResultEvaluator.unstable.one.new.priority=<a href="{3}">1 new warning</a> of <a href="{4}">priority {2}</a> exceeds the threshold of {0} by {1}
BuildResultEvaluator.unstable.all.priority=<a href="{4}">{0} warnings</a> of <a href="{5}">priority {3}</a> exceed the threshold of {1} by {2}
BuildResultEvaluator.unstable.one.all.priority=<a href="{3}">1 warning</a> of <a href="{4}">priority {2}</a> exceeds the threshold of {0} by {1}
BuildResultEvaluator.unstable.new=<a href="{3}">{0} new warnings</a> exceed the threshold of {1} by {2}
BuildResultEvaluator.unstable.one.new=<a href="{2}">1 new warning</a> exceeds the threshold of {0} by {1}
BuildResultEvaluator.unstable.all=<a href="{3}">{0} warnings</a> exceed the threshold of {1} by {2}
BuildResultEvaluator.unstable.one.all=<a href="{2}">1 warning</a> exceeds the threshold of {0} by {1}

Expand Up @@ -85,6 +85,10 @@ ResultAction.MultipleFiles=aus {0} Analysen.

BuildResultEvaluator.success=Kein Grenzwert wurde überschritten
BuildResultEvaluator.unstable.new.priority=<a href="{4}">{0} neue Warnungen</a> der <a href="{5}">Priorität {3}</a> haben die erlaubte Obergrenze von {1} um {2} überschritten
BuildResultEvaluator.unstable.one.new.priority=<a href="{3}">1 neue Warnung</a> der <a href="{4}">Priorität {2}</a> hat die erlaubte Obergrenze von {0} um {1} überschritten
BuildResultEvaluator.unstable.all.priority=<a href="{4}">{0} Warnungen</a> der <a href="{5}">Priorität {3}</a> haben die erlaubte Obergrenze von {1} um {2} überschritten
BuildResultEvaluator.unstable.one.all.priority=<a href="{3}">1 Warnung</a> der <a href="{4}">Priorität {2}</a> hat die erlaubte Obergrenze von {0} um {1} überschritten
BuildResultEvaluator.unstable.new=<a href="{3}">{0} neue Warnungen</a> haben die erlaubte Obergrenze von {1} um {2} überschritten
BuildResultEvaluator.unstable.one.new=<a href="{2}">1 neue Warnung</a> hat die erlaubte Obergrenze von {0} um {1} überschritten
BuildResultEvaluator.unstable.all=<a href="{3}">{0} Warnungen</a> haben die erlaubte Obergrenze von {1} um {2} überschritten
BuildResultEvaluator.unstable.one.all=<a href="{2}">1 Warnung</a> hat die erlaubte Obergrenze von {0} um {1} überschritten

0 comments on commit 5c21e80

Please sign in to comment.