Skip to content

Commit

Permalink
Merge pull request #575 from jenkinsci/dependabot/maven/org.jvnet.hud…
Browse files Browse the repository at this point in the history
…son.plugins-analysis-pom-10.2.0

Bump org.jvnet.hudson.plugins:analysis-pom from 8.6.0 to 10.2.0
  • Loading branch information
uhafner authored Feb 14, 2025
2 parents c11a16f + f52e26b commit cbd1eeb
Show file tree
Hide file tree
Showing 70 changed files with 584 additions and 554 deletions.
24 changes: 12 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.jvnet.hudson.plugins</groupId>
<artifactId>analysis-pom</artifactId>
<version>8.6.0</version>
<version>10.2.0</version>
<relativePath />
</parent>

Expand All @@ -18,17 +18,6 @@
<description>Defines an API for Jenkins to mine and analyze data from a source code repository.</description>
<url>https://github.com/jenkinsci/forensics-api-plugin</url>

<properties>
<revision>2.8.0</revision>
<changelist>-SNAPSHOT</changelist>

<module.name>${project.groupId}.forensics.api</module.name>

<!-- Library Dependencies Versions -->
<testcontainers.version>1.20.4</testcontainers.version>

</properties>

<licenses>
<license>
<name>MIT license</name>
Expand All @@ -51,6 +40,17 @@
<tag>${scmTag}</tag>
</scm>

<properties>
<revision>2.8.0</revision>
<changelist>-SNAPSHOT</changelist>

<module.name>${project.groupId}.forensics.api</module.name>

<!-- Library Dependencies Versions -->
<testcontainers.version>1.20.4</testcontainers.version>

</properties>

<dependencies>

<dependency>
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/io/jenkins/plugins/forensics/blame/Blamer.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
package io.jenkins.plugins.forensics.blame;

import java.io.Serializable;

import edu.hm.hafner.util.FilteredLog;

import java.io.Serial;
import java.io.Serializable;

/**
* Obtains SCM blame information for several file locations.
*
* @author Lukas Krose
*/
public abstract class Blamer implements Serializable {
@Serial
private static final long serialVersionUID = 1980235877389921937L;

/**
Expand All @@ -28,6 +30,7 @@ public abstract class Blamer implements Serializable {
* A blamer that does nothing.
*/
public static class NullBlamer extends Blamer {
@Serial
private static final long serialVersionUID = 6235885974889709821L;

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package io.jenkins.plugins.forensics.blame;

import edu.hm.hafner.util.FilteredLog;

import java.util.Collection;
import java.util.List;
import java.util.Optional;

import edu.hm.hafner.util.FilteredLog;

import hudson.ExtensionPoint;
import hudson.FilePath;
import hudson.model.Run;
Expand Down Expand Up @@ -106,7 +106,7 @@ private static Blamer createNullBlamer(final FilteredLog logger) {

private static Optional<Blamer> findBlamer(final Run<?, ?> run, final FilePath workTree,
final TaskListener listener, final FilteredLog logger) {
SCM scm = new ScmResolver().getScm(run);
var scm = new ScmResolver().getScm(run);

return findAllExtensions().stream()
.map(blamerFactory -> blamerFactory.createBlamer(scm, run, workTree, listener, logger))
Expand Down
8 changes: 5 additions & 3 deletions src/main/java/io/jenkins/plugins/forensics/blame/Blames.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.jenkins.plugins.forensics.blame;

import java.io.Serial;
import java.io.Serializable;
import java.util.HashMap;
import java.util.HashSet;
Expand All @@ -15,6 +16,7 @@
* @author Ullrich Hafner
*/
public class Blames implements Serializable {
@Serial
private static final long serialVersionUID = 7L; // release 0.7

private final Map<String, FileBlame> blamesPerFile = new HashMap<>();
Expand All @@ -37,7 +39,7 @@ public void add(final FileBlame additionalBlame) {
*/
public void addAll(final Blames other) {
for (String otherFile : other.getFiles()) {
FileBlame otherRequest = other.getBlame(otherFile);
var otherRequest = other.getBlame(otherFile);
merge(otherFile, otherRequest);
}
}
Expand Down Expand Up @@ -104,7 +106,7 @@ public FileBlame getBlame(final String fileName) {
if (blamesPerFile.containsKey(fileName)) {
return blamesPerFile.get(fileName);
}
throw new NoSuchElementException(String.format("No blame information for file '%s' stored", fileName));
throw new NoSuchElementException("No blame information for file '%s' stored".formatted(fileName));
}

@Override
Expand All @@ -115,7 +117,7 @@ public boolean equals(final Object o) {
if (o == null || getClass() != o.getClass()) {
return false;
}
Blames blames = (Blames) o;
var blames = (Blames) o;
return blamesPerFile.equals(blames.blamesPerFile);
}

Expand Down
29 changes: 17 additions & 12 deletions src/main/java/io/jenkins/plugins/forensics/blame/FileBlame.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
package io.jenkins.plugins.forensics.blame;

import edu.hm.hafner.util.PathUtil;
import edu.hm.hafner.util.TreeString;
import edu.hm.hafner.util.TreeStringBuilder;
import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.NonNull;

import java.io.Serial;
import java.io.Serializable;
import java.util.HashMap;
import java.util.HashSet;
Expand All @@ -8,19 +15,14 @@
import java.util.Objects;
import java.util.Set;

import edu.hm.hafner.util.PathUtil;
import edu.hm.hafner.util.TreeString;
import edu.hm.hafner.util.TreeStringBuilder;
import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.NonNull;

/**
* Stores the repository blames for several lines of a single file. File names are stored using the absolute path of the
* file.
*
* @author Ullrich Hafner
*/
public class FileBlame implements Iterable<Integer>, Serializable {
public final class FileBlame implements Iterable<Integer>, Serializable {
@Serial
private static final long serialVersionUID = 7L; // release 0.7

static final String EMPTY = "-";
Expand All @@ -45,14 +47,16 @@ private FileBlame(final TreeString fileName) {
*
* @return this
*/
protected Object readResolve() {
@Serial
@SuppressWarnings("DataFlowIssue")
private Object readResolve() {
if (timeByLine == null) {
timeByLine = new HashMap<>();
}
if (blamesByLine == null) {
blamesByLine = new HashMap<>();
for (Integer line : lines) {
LineBlame lineBlame = new LineBlame();
var lineBlame = new LineBlame();
lineBlame.setName(nameByLine.get(line));
lineBlame.setEmail(emailByLine.get(line));
lineBlame.setCommit(commitByLine.get(line));
Expand Down Expand Up @@ -204,7 +208,7 @@ public void merge(final FileBlame other) {
}
else {
throw new IllegalArgumentException(
String.format("File names must match! This instance: %s, other instance: %s",
"File names must match! This instance: %s, other instance: %s".formatted(
getFileName(), other.getFileName()));
}
}
Expand All @@ -222,7 +226,7 @@ public boolean equals(final Object o) {
if (o == null || getClass() != o.getClass()) {
return false;
}
FileBlame integers = (FileBlame) o;
var integers = (FileBlame) o;
return fileName.equals(integers.fileName) && Objects.equals(blamesByLine, integers.blamesByLine);
}

Expand All @@ -233,6 +237,7 @@ public int hashCode() {

@SuppressWarnings("PMD.DataClass")
private static class LineBlame implements Serializable {
@Serial
private static final long serialVersionUID = 7L; // release 0.7
private String name = EMPTY;
private String email = EMPTY;
Expand Down Expand Up @@ -279,7 +284,7 @@ public boolean equals(final Object o) {
if (o == null || getClass() != o.getClass()) {
return false;
}
LineBlame lineBlame = (LineBlame) o;
var lineBlame = (LineBlame) o;
return addedAt == lineBlame.addedAt
&& name.equals(lineBlame.name)
&& email.equals(lineBlame.email)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.jenkins.plugins.forensics.blame;

import java.io.Serial;
import java.io.Serializable;
import java.util.Collections;
import java.util.HashMap;
Expand All @@ -16,6 +17,7 @@
* @author Ullrich Hafner
*/
public class FileLocations implements Serializable {
@Serial
private static final long serialVersionUID = 8063580789984061223L;

private final Map<String, Set<Integer>> linesPerFile = new HashMap<>();
Expand Down Expand Up @@ -101,7 +103,7 @@ public Set<Integer> getLines(final String fileName) {
if (containsFile(fileName)) {
return Collections.unmodifiableSet(linesPerFile.get(fileName));
}
throw new NoSuchElementException(String.format("No information for file '%s' stored", fileName));
throw new NoSuchElementException("No information for file '%s' stored".formatted(fileName));
}

@Override
Expand All @@ -112,7 +114,7 @@ public boolean equals(final Object o) {
if (o == null || getClass() != o.getClass()) {
return false;
}
FileLocations that = (FileLocations) o;
var that = (FileLocations) o;
return linesPerFile.equals(that.linesPerFile);
}

Expand Down
4 changes: 3 additions & 1 deletion src/main/java/io/jenkins/plugins/forensics/delta/Change.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.jenkins.plugins.forensics.delta;

import java.io.Serial;
import java.io.Serializable;
import java.util.Objects;

Expand All @@ -16,6 +17,7 @@
*/
@SuppressWarnings("PMD.DataClass")
public class Change implements Serializable {
@Serial
private static final long serialVersionUID = 1543635877389921937L;

private final ChangeEditType changeEditType;
Expand Down Expand Up @@ -89,7 +91,7 @@ public boolean equals(final Object o) {
if (o == null || getClass() != o.getClass()) {
return false;
}
Change change = (Change) o;
var change = (Change) o;
return changedFromLine == change.changedFromLine && changedToLine == change.changedToLine
&& fromLine == change.fromLine && toLine == change.toLine && changeEditType == change.changeEditType;
}
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/io/jenkins/plugins/forensics/delta/Delta.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.jenkins.plugins.forensics.delta;

import java.io.Serial;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
Expand All @@ -13,6 +14,7 @@
*/
@SuppressWarnings("PMD.DataClass")
public class Delta implements Serializable {
@Serial
private static final long serialVersionUID = 5641235877389921937L;

static final String ERROR_MESSAGE_UNKNOWN_FILE = "No information about changes for the file with the ID '%s' stored";
Expand Down Expand Up @@ -66,7 +68,7 @@ public FileChanges getFileChangesById(final String fileId) {
if (fileChangesMap.containsKey(fileId)) {
return fileChangesMap.get(fileId);
}
throw new NoSuchElementException(String.format(ERROR_MESSAGE_UNKNOWN_FILE, fileId));
throw new NoSuchElementException(ERROR_MESSAGE_UNKNOWN_FILE.formatted(fileId));
}

/**
Expand All @@ -92,7 +94,7 @@ public boolean equals(final Object o) {
if (o == null || getClass() != o.getClass()) {
return false;
}
Delta delta = (Delta) o;
var delta = (Delta) o;
return Objects.equals(currentCommit, delta.currentCommit)
&& Objects.equals(referenceCommit, delta.referenceCommit)
&& Objects.equals(fileChangesMap, delta.fileChangesMap);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package io.jenkins.plugins.forensics.delta;

import java.io.Serializable;
import java.util.Optional;

import org.apache.commons.lang3.StringUtils;

import edu.hm.hafner.util.FilteredLog;

import java.io.Serial;
import java.io.Serializable;
import java.util.Optional;

import hudson.model.Run;

/**
Expand All @@ -15,6 +16,7 @@
* @author Florian Orendi
*/
public abstract class DeltaCalculator implements Serializable {
@Serial
private static final long serialVersionUID = 8641535877389921937L;

/**
Expand Down Expand Up @@ -57,6 +59,7 @@ public abstract Optional<Delta> calculateDelta(Run<?, ?> build, Run<?, ?> refere
* A delta calculator that does nothing.
*/
public static class NullDeltaCalculator extends DeltaCalculator {
@Serial
private static final long serialVersionUID = 1564285974889709821L;

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package io.jenkins.plugins.forensics.delta;

import edu.hm.hafner.util.FilteredLog;

import java.util.Collection;
import java.util.List;
import java.util.Optional;

import edu.hm.hafner.util.FilteredLog;

import hudson.ExtensionPoint;
import hudson.FilePath;
import hudson.model.Run;
Expand Down Expand Up @@ -96,7 +96,7 @@ public static DeltaCalculator findDeltaCalculator(final String scm, final Run<?,
*/
private static Optional<DeltaCalculator> findDeltaCalculator(final Run<?, ?> run, final FilePath workTree,
final TaskListener listener, final FilteredLog logger) {
SCM scm = new ScmResolver().getScm(run);
var scm = new ScmResolver().getScm(run);
return findAllDeltaCalculatorFactoryInstances().stream()
.map(deltaCalculatorFactory -> deltaCalculatorFactory.createDeltaCalculator(scm, run, workTree,
listener, logger))
Expand Down
Loading

0 comments on commit cbd1eeb

Please sign in to comment.