YETUS-116. add checkstyle option for maven goal Signed-off-by: Allen Wittenauer <[email protected]>
Project: http://git-wip-us.apache.org/repos/asf/yetus/repo Commit: http://git-wip-us.apache.org/repos/asf/yetus/commit/e26177a0 Tree: http://git-wip-us.apache.org/repos/asf/yetus/tree/e26177a0 Diff: http://git-wip-us.apache.org/repos/asf/yetus/diff/e26177a0 Branch: refs/heads/YETUS-83 Commit: e26177a03d7629e28464dc3a1687e6ef73bfb7fa Parents: f2fefdb Author: Tony Kurc <[email protected]> Authored: Tue Nov 3 20:52:03 2015 -0500 Committer: Allen Wittenauer <[email protected]> Committed: Fri Nov 6 09:07:12 2015 -0800 ---------------------------------------------------------------------- precommit/test-patch.d/checkstyle.sh | 38 +++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/yetus/blob/e26177a0/precommit/test-patch.d/checkstyle.sh ---------------------------------------------------------------------- diff --git a/precommit/test-patch.d/checkstyle.sh b/precommit/test-patch.d/checkstyle.sh index 24b9ffc..236664a 100755 --- a/precommit/test-patch.d/checkstyle.sh +++ b/precommit/test-patch.d/checkstyle.sh @@ -17,6 +17,10 @@ add_test_type checkstyle CHECKSTYLE_TIMER=0 +CHECKSTYLE_GOAL_DEFAULT="checkstyle" +CHECKSTYLE_GOAL="${CHECKSTYLE_GOAL_DEFAULT}" +CHECKSTYLE_OPTIONS_DEFAULT="-Dcheckstyle.consoleOutput=true" +CHECKSTYLE_OPTIONS="${CHECKSTYLE_OPTIONS_DEFAULT}" function checkstyle_filefilter { @@ -30,6 +34,36 @@ function checkstyle_filefilter fi } +function checkstyle_usage +{ + echo "Checkstyle options:" + echo "--checkstyle-goal=<goal> Checkstyle maven plugin goal to use, 'check' and 'checkstyle' supported. Defaults to '${CHECKSTYLE_GOAL_DEFAULT}'." +} + +function checkstyle_parse_args +{ + local i + + for i in "$@"; do + case ${i} in + --checkstyle-goal=*) + CHECKSTYLE_GOAL=${i#*=} + case ${CHECKSTYLE_GOAL} in + check) + CHECKSTYLE_OPTIONS="-Dcheckstyle.consoleOutput=true -Dcheckstyle.failOnViolation=false" + ;; + checkstyle) + ;; + *) + yetus_error "Warning: checkstyle goal ${CHECKSTYLE_GOAL} not supported. It may have unexpected behavior" + ;; + esac + ;; + esac + done +} + + function checkstyle_runner { local repostatus=$1 @@ -74,8 +108,8 @@ function checkstyle_runner ;; maven) cmd="${MAVEN} ${MAVEN_ARGS[*]} \ - checkstyle:checkstyle \ - -Dcheckstyle.consoleOutput=true \ + checkstyle:${CHECKSTYLE_GOAL} \ + ${CHECKSTYLE_OPTIONS} \ ${MODULEEXTRAPARAM[${i}]//@@@MODULEFN@@@/${fn}} -Ptest-patch" ;; *)
