Skip to content

Commit

Permalink
Remove static array creation in isStatusMessage()
Browse files Browse the repository at this point in the history
  • Loading branch information
robertoffmoura committed Oct 5, 2024
1 parent 4add480 commit 2b9a912
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public class StashRepository {
"\\[\\*BuildFinished\\* \\*\\*%s\\*\\*\\] ([0-9a-fA-F]+) into ([0-9a-fA-F]+)";
private static final String BUILD_CANCEL_REGEX =
"\\[\\*BuildCanceled\\* \\*\\*%s\\*\\*\\] ([0-9a-fA-F]+) into ([0-9a-fA-F]+)";
private static final String[] BUILD_REGEXES = {BUILD_START_REGEX, BUILD_FINISH_REGEX, BUILD_CANCEL_REGEX};

private static final String BUILD_FINISH_SENTENCE =
BUILD_FINISH_MARKER + " %n%n **[%s](%s)** - Build *#%d* which took *%s*";
Expand Down Expand Up @@ -147,8 +148,7 @@ private boolean shouldSkip(StashPullRequestResponseValue pullRequest) {

private boolean isStatusMessage(String content) {
String escapedBuildName = Pattern.quote(job.getDisplayName());
String[] patterns = {BUILD_START_REGEX, BUILD_FINISH_REGEX, BUILD_CANCEL_REGEX};
for (String pattern : patterns) {
for (String pattern : BUILD_REGEXES) {
String buildStatusMessage = String.format(pattern, escapedBuildName);
Matcher matcher =

Check warning on line 153 in src/main/java/stashpullrequestbuilder/stashpullrequestbuilder/StashRepository.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 153 is only partially covered, one branch is missing
Pattern.compile(buildStatusMessage, Pattern.CASE_INSENSITIVE).matcher(content);
Expand Down

0 comments on commit 2b9a912

Please sign in to comment.