33trap ' rm -f result.txt >/dev/null 2>&1' EXIT
44
55# --- auxiliares -------------------------------------------------------
6-
76run_codenarc () {
8- local report=" ${INPUT_REPORT:- compact: stdout} "
9- local includes_arg=" "
7+ report=" ${INPUT_REPORT:- compact: stdout} "
8+ includes_arg=" "
109
1110 if [ -n " $INPUT_SOURCE_FILES " ]; then
1211 includes_arg=" -includes=${INPUT_SOURCE_FILES} "
1312 fi
1413
1514 echo " 🔍 Executando CodeNarc..."
1615 java -jar /lib/codenarc-all.jar \
17- -report=" $report " \
18- -rulesetfiles=" ${INPUT_RULESETFILES} " \
19- -basedir=" ." \
20- $includes_arg \
21- > result.txt
16+ -report=" $report " \
17+ -rulesetfiles=" ${INPUT_RULESETFILES} " \
18+ -basedir=" ." \
19+ $includes_arg \
20+ > result.txt
2221}
2322
2423run_reviewdog () {
2524 echo " 📤 Enviando resultados para reviewdog..."
2625 < result.txt reviewdog -efm=" %f:%l:%m" -efm=" %f:%r:%m" \
27- -name=" codenarc" \
28- -reporter=" ${INPUT_REPORTER:- github-pr-check} " \
29- -filter-mode=" ${INPUT_FILTER_MODE} " \
30- -fail-on-error=" ${INPUT_FAIL_ON_ERROR} " \
31- -level=" ${INPUT_LEVEL} " \
32- ${INPUT_REVIEWDOG_FLAGS}
26+ -name=" codenarc" \
27+ -reporter=" ${INPUT_REPORTER:- github-pr-check} " \
28+ -filter-mode=" ${INPUT_FILTER_MODE} " \
29+ -fail-on-error=" ${INPUT_FAIL_ON_ERROR} " \
30+ -level=" ${INPUT_LEVEL} " \
31+ ${INPUT_REVIEWDOG_FLAGS}
3332}
3433
3534check_blocking_rules () {
3635 if [ " ${INPUT_GRAILS_VERSION} " = " 4" ]; then
3736 echo " 🔎 Verificando violacoes bloqueantes (priority 1 ou 2)..."
3837
39- local p1_count=$( grep -Eo " p1=[0-9]+" result.txt | cut -d' =' -f2 | tail -1)
40- local p2_count=$( grep -Eo " p2=[0-9]+" result.txt | cut -d' =' -f2 | tail -1)
38+ p1_count=$( grep -Eo " p1=[0-9]+" result.txt | cut -d' =' -f2 | head -1)
39+ p2_count=$( grep -Eo " p2=[0-9]+" result.txt | cut -d' =' -f2 | head -1)
4140
4241 p1_count=${p1_count:- 0}
4342 p2_count=${p2_count:- 0}
@@ -58,7 +57,7 @@ check_blocking_rules() {
5857
5958# --- principal -------------------------------------------------------
6059
61- if [ -n " ${GITHUB_WORKSPACE} " ] ; then
60+ if [ -n " ${GITHUB_WORKSPACE} " ]; then
6261 cd " ${GITHUB_WORKSPACE} /${INPUT_WORKDIR} " || exit
6362 git config --global --add safe.directory " $GITHUB_WORKSPACE "
6463fi
0 commit comments