Skip to content

Commit 18fa8a3

Browse files
authored
Have apply-error-prone-suggestions.sh iterate until fix-point (#1983)
By applying the patch operation until no more changes are made, the script behaves more intuitively, and Reviewdog PR suggestions will be more comprehensive.
1 parent e8a922f commit 18fa8a3

File tree

1 file changed

+28
-9
lines changed

1 file changed

+28
-9
lines changed

apply-error-prone-suggestions.sh

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,31 @@ fi
1515

1616
patchChecks=${1:-}
1717

18-
mvn clean test-compile fmt:format \
19-
-s "$(dirname "${0}")/settings.xml" \
20-
-T 1.0C \
21-
-Perror-prone \
22-
-Perror-prone-fork \
23-
-Ppatch \
24-
-Pself-check \
25-
-Derror-prone.patch-checks="${patchChecks}" \
26-
-Dverification.skip
18+
# Use mvnd if installed.
19+
mvn='mvn -T 1.0C'
20+
if command -v mvnd >/dev/null 2>&1; then
21+
mvn='mvnd'
22+
fi
23+
24+
function patch() {
25+
local current_diff="${1}"
26+
27+
${mvn} clean test-compile fmt:format \
28+
-s "$(dirname "${0}")/settings.xml" \
29+
-T 1.0C \
30+
-Perror-prone \
31+
-Perror-prone-fork \
32+
-Ppatch \
33+
-Pself-check \
34+
-Derror-prone.patch-checks="${patchChecks}" \
35+
-Dverification.skip
36+
37+
local new_diff
38+
new_diff="$(git diff)"
39+
40+
if [ "${current_diff}" != "${new_diff}" ]; then
41+
patch "${new_diff}"
42+
fi
43+
}
44+
45+
patch "$(git diff)"

0 commit comments

Comments
 (0)