From 336557cf8ec84260a05ee855b649dd3ef0aaa444 Mon Sep 17 00:00:00 2001 From: Stephan Schroevers Date: Wed, 3 Aug 2022 17:05:38 +0200 Subject: [PATCH] Introduce `apply-error-prone-suggestions.sh` (#171) This script compiles the code using Error Prone and applies its suggestions. The set of checks applied can optionally be restricted by name. --- apply-error-prone-suggestions.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 apply-error-prone-suggestions.sh diff --git a/apply-error-prone-suggestions.sh b/apply-error-prone-suggestions.sh new file mode 100755 index 00000000..da403679 --- /dev/null +++ b/apply-error-prone-suggestions.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +# Compiles the code using Error Prone and applies its suggestions. The set of +# checks applied can optionally be restricted by name. +# +# As this script may modify the project's code, it is important to execute it +# in a clean Git working directory. + +set -e -u -o pipefail + +if [ "${#}" -gt 1 ]; then + echo "Usage: ./$(basename "${0}") [PatchChecks]" + exit 1 +fi + +patchChecks=${1:-} + +mvn clean test-compile fmt:format \ + -T 1.0C \ + -Perror-prone \ + -Perror-prone-fork \ + -Ppatch \ + -Pself-check \ + -Derror-prone.patch-checks="${patchChecks}" \ + -Dverification.skip