Skip to content

Commit

Permalink
Fix PMD errors
Browse files Browse the repository at this point in the history
  • Loading branch information
svenschoenung committed Jul 24, 2018
1 parent 15d5461 commit 6c0289b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .pmd.config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
<exclude name="LongVariable" />
<!-- No need for empty constructors -->
<exclude name="AtLeastOneConstructor" />
<!-- This complains about variable names like 'id' -->
<exclude name="ShortVariable" />
</rule>
<rule ref="category/java/design.xml">
<!-- "Tell, don't ask" is a good design principle,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ public class CalendarEvent {
private final String url;
private final long duration;

private List<CalendarEvent> lastEvents;
private CalendarEvent previousEvent;
private CalendarEvent nextEvent;
private CalendarEvent nextScheduledEvent;
private transient List<CalendarEvent> lastEvents;
private transient CalendarEvent previousEvent;
private transient CalendarEvent nextEvent;
private transient CalendarEvent nextScheduledEvent;

@SuppressWarnings("PMD.NullAssignment")
public CalendarEvent(final TopLevelItem item, final Calendar start, final long durationInMillis) {
Expand Down Expand Up @@ -72,8 +72,8 @@ public CalendarEvent(final TopLevelItem item, final Run build) {
this.end = initEnd(this.start, build.getDuration());
}

private static String initId(String url) {
return url.replace("/", "-").toLowerCase().replaceAll("-$", "");
private static String initId(final String url) {
return url.replace("/", "-").toLowerCase(Locale.ENGLISH).replaceAll("-$", "");
}

private static Calendar initEnd(final Calendar start, final long duration) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ public List<CalendarEvent> getLastEvents(final CalendarEvent event, final int nu
if (item instanceof Job) {
final List<Build> lastBuilds = ((Job) item).getLastBuildsOverThreshold(numberOfEvents, Result.ABORTED);
for (final Build lastBuild: lastBuilds) {
lastEvents.add(new CalendarEvent(item, lastBuild));
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
final CalendarEvent lastEvent = new CalendarEvent(item, lastBuild);
lastEvents.add(lastEvent);
}
}
return lastEvents;
Expand Down

0 comments on commit 6c0289b

Please sign in to comment.