Skip to content

Commit

Permalink
checkstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahdeitke committed Feb 14, 2025
1 parent 01fd797 commit b29ecd3
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/main/java/io/jenkins/plugins/checks/api/ChecksOutput.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,26 +101,26 @@ public String toString() {
/**
* Truncates the summary to the given maxSize. Tries to truncate from start of build log section if possible.
*
* @param summary the summary to truncate
* @param summaryToTruncate the summary to truncate
* @param maxSize the maximum size to truncate to
* @return the truncated summary
*/
private Optional<String> truncateSummary(final TruncatedString summary, final int maxSize) {
if (summary == null) {
private Optional<String> truncateSummary(final TruncatedString summaryToTruncate, final int maxSize) {
if (summaryToTruncate == null) {
return Optional.empty();
}

String content = summary.toString();
String content = summaryToTruncate.toString();
if (!content.contains("<summary>")) {
return Optional.of(summary.build(maxSize));
return Optional.of(summaryToTruncate.build(maxSize));

Check warning on line 115 in src/main/java/io/jenkins/plugins/checks/api/ChecksOutput.java

View check run for this annotation

ci.jenkins.io / Java Compiler

compiler:compile

NORMAL: build(int) in io.jenkins.plugins.checks.api.TruncatedString has been deprecated
}

// Find the build log section
int detailsStart = content.indexOf("<details>");
int detailsEnd = content.indexOf("</details>") + "</details>".length();

if (detailsStart == -1 || detailsEnd == -1) {

Check warning on line 122 in src/main/java/io/jenkins/plugins/checks/api/ChecksOutput.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 122 is only partially covered, 2 branches are missing
return Optional.of(summary.build(maxSize));
return Optional.of(summaryToTruncate.build(maxSize));

Check warning on line 123 in src/main/java/io/jenkins/plugins/checks/api/ChecksOutput.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 123 is not covered by tests

Check warning on line 123 in src/main/java/io/jenkins/plugins/checks/api/ChecksOutput.java

View check run for this annotation

ci.jenkins.io / Java Compiler

compiler:compile

NORMAL: build(int) in io.jenkins.plugins.checks.api.TruncatedString has been deprecated
}

// Split into pre-details, details block, and post-details
Expand All @@ -133,7 +133,7 @@ private Optional<String> truncateSummary(final TruncatedString summary, final in
int logEnd = details.lastIndexOf("\n```");

if (logStart == -1 || logEnd == -1) {

Check warning on line 135 in src/main/java/io/jenkins/plugins/checks/api/ChecksOutput.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 135 is only partially covered, 2 branches are missing
return Optional.of(summary.build(maxSize));
return Optional.of(summaryToTruncate.build(maxSize));

Check warning on line 136 in src/main/java/io/jenkins/plugins/checks/api/ChecksOutput.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 136 is not covered by tests

Check warning on line 136 in src/main/java/io/jenkins/plugins/checks/api/ChecksOutput.java

View check run for this annotation

ci.jenkins.io / Java Compiler

compiler:compile

NORMAL: build(int) in io.jenkins.plugins.checks.api.TruncatedString has been deprecated
}

String beforeLog = details.substring(0, logStart);
Expand All @@ -146,7 +146,7 @@ private Optional<String> truncateSummary(final TruncatedString summary, final in

if (availableForLog <= 0) {
// If no space for log, truncate the whole content
return Optional.of(summary.build(maxSize));
return Optional.of(summaryToTruncate.build(maxSize));

Check warning on line 149 in src/main/java/io/jenkins/plugins/checks/api/ChecksOutput.java

View check run for this annotation

ci.jenkins.io / Java Compiler

compiler:compile

NORMAL: build(int) in io.jenkins.plugins.checks.api.TruncatedString has been deprecated
}

// Truncate the log using TruncatedString
Expand Down

0 comments on commit b29ecd3

Please sign in to comment.