Skip to content

Commit 2b9a912

Browse files
Remove static array creation in isStatusMessage()
1 parent 4add480 commit 2b9a912

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/stashpullrequestbuilder/stashpullrequestbuilder/StashRepository.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public class StashRepository {
5959
"\\[\\*BuildFinished\\* \\*\\*%s\\*\\*\\] ([0-9a-fA-F]+) into ([0-9a-fA-F]+)";
6060
private static final String BUILD_CANCEL_REGEX =
6161
"\\[\\*BuildCanceled\\* \\*\\*%s\\*\\*\\] ([0-9a-fA-F]+) into ([0-9a-fA-F]+)";
62+
private static final String[] BUILD_REGEXES = {BUILD_START_REGEX, BUILD_FINISH_REGEX, BUILD_CANCEL_REGEX};
6263

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

148149
private boolean isStatusMessage(String content) {
149150
String escapedBuildName = Pattern.quote(job.getDisplayName());
150-
String[] patterns = {BUILD_START_REGEX, BUILD_FINISH_REGEX, BUILD_CANCEL_REGEX};
151-
for (String pattern : patterns) {
151+
for (String pattern : BUILD_REGEXES) {
152152
String buildStatusMessage = String.format(pattern, escapedBuildName);
153153
Matcher matcher =
154154
Pattern.compile(buildStatusMessage, Pattern.CASE_INSENSITIVE).matcher(content);

0 commit comments

Comments
 (0)