Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ inputs:
This field will always try to follow Checkstyle releases as close as possible and will use the latest available by default.
If it is not a default preference for your project, please, pin the needed version using this property.
default: ""
checkstyle_classpath:
description: |
Classpath for checkstyle. This is needed when your checkstyle configuration uses custom checks that are not included in the default checkstyle distribution.
You can specify either a single jar file or a directory with multiple jar files. In the latter case, all jar files in the directory will be added to the classpath.
default: ""
properties_file:
description: |
Location of the properties file relative to the root directory. This file serves as a means to resolve repetitive or predefined values within the checkstyle configuration file.
Expand Down
11 changes: 10 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ if [ -n "${INPUT_PROPERTIES_FILE}" ]; then
OPTIONAL_PROPERTIES_FILE="-p ${INPUT_PROPERTIES_FILE}"
fi

CHECKSTYLE_CLASSPATH="/opt/lib/checkstyle.jar"
if [ -n "${INPUT_CHECKSTYLE_CLASSPATH}" ]; then
CHECKSTYLE_CLASSPATH="${CHECKSTYLE_CLASSPATH}:${INPUT_CHECKSTYLE_CLASSPATH}"
fi

# user wants to use custom Checkstyle version, try to install it
if [ -n "${INPUT_CHECKSTYLE_VERSION}" ]; then
echo '::group::📥 Installing user-defined Checkstyle version ... https://github.com/checkstyle/checkstyle'
Expand All @@ -38,7 +43,11 @@ echo '::group:: Running Checkstyle with reviewdog 🐶 ...'
{ echo "Run check with"; java -jar /opt/lib/checkstyle.jar --version; } | sed ':a;N;s/\n/ /;ba'

# shellcheck disable=SC2086
exec java -jar /opt/lib/checkstyle.jar "${INPUT_WORKDIR}" -c "${INPUT_CHECKSTYLE_CONFIG}" ${OPTIONAL_PROPERTIES_FILE} -f xml \
exec \
java \
-cp ${CHECKSTYLE_CLASSPATH} \
com.puppycrawl.tools.checkstyle.Main "${INPUT_WORKDIR}" \
-c "${INPUT_CHECKSTYLE_CONFIG}" ${OPTIONAL_PROPERTIES_FILE} -f xml \
| reviewdog -f=checkstyle \
-name="checkstyle" \
-reporter="${INPUT_REPORTER:-github-pr-check}" \
Expand Down