Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed PMD issues #33

Merged
merged 1 commit into from
Oct 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ private abstract class CalendarEventImpl implements CalendarEvent {
protected long duration;
private transient List<StartedCalendarEvent> lastEvents;

protected String initId(final String url, final long startTimeInMillis) {
/* default */ final String initId(final String url, final long startTimeInMillis) {
return StringUtils.defaultString(url, "")
.replace("/", "-")
.toLowerCase(Locale.ENGLISH) + startTimeInMillis;
}

protected Moment initEnd(final long timeInMillis, final long duration) {
/* default */ final Moment initEnd(final long timeInMillis, final long duration) {
// duration needs to be at least 1sec otherwise
// fullcalendar will not properly display the event
final long dur = (duration < 1000) ? 1000 : duration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import hudson.model.Result;
import hudson.model.Run;
import hudson.scheduler.CronTab;
import hudson.util.RunList;
import io.jenkins.plugins.view.calendar.CalendarView.CalendarViewEventsType;
import io.jenkins.plugins.view.calendar.event.CalendarEvent;
import io.jenkins.plugins.view.calendar.event.CalendarEventComparator;
Expand Down Expand Up @@ -222,7 +221,7 @@ public List<StartedCalendarEvent> getStartedEvents(final List<? extends Job> job
if (state == CalendarEventState.RUNNING && !job.isBuilding()) {
continue;
}
final RunList<Run> builds = job.getBuilds();
final List<Run> builds = job.getBuilds();
for (final Run build : builds) {
if (state == CalendarEventState.RUNNING && !build.isBuilding()) {
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public List<CronTab> getCronTabs(final Trigger trigger, final Hash hash) {

@SuppressWarnings("PMD.CyclomaticComplexity")
public List<Trigger> getCronTriggers(final Job job, final CalendarViewEventsType eventsType) {
Collection<Trigger<?>> jobTriggers;
final Collection<Trigger<?>> jobTriggers;
if (job instanceof AbstractProject) {
jobTriggers = ((AbstractProject)job).getTriggers().values();
} else if (PluginUtil.hasWorkflowJobPluginInstalled() && job instanceof WorkflowJob) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,7 @@ public int hashCode() {

@Override
public boolean equals(final Object o) {
if (!(o instanceof Moment)) {
return false;
}
return calendar.equals(((Moment)o).calendar);
return (o instanceof Moment) && calendar.equals(((Moment)o).calendar);
}

@Override
Expand Down