-
Notifications
You must be signed in to change notification settings - Fork 0
feat(DVT‑730): bloquear merge em violacoes bloqueantes (priority 1) do CodeNarc #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0b20c6c
d261373
00cf0f0
f6f54ad
611d3ca
f93d2f1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,34 +1,61 @@ | ||||||
| #!/bin/sh | ||||||
| set -e | ||||||
| trap 'rm -f result.txt >/dev/null 2>&1' EXIT | ||||||
|
|
||||||
| if [ -n "${GITHUB_WORKSPACE}" ] ; then | ||||||
| cd "${GITHUB_WORKSPACE}/${INPUT_WORKDIR}" || exit | ||||||
| git config --global --add safe.directory "$GITHUB_WORKSPACE" || exit | ||||||
| fi | ||||||
| run_codenarc() { | ||||||
| report="${INPUT_REPORT:-compact:stdout}" | ||||||
| includes_arg="" | ||||||
|
|
||||||
| export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}" | ||||||
| if [ -n "$INPUT_SOURCE_FILES" ]; then | ||||||
| includes_arg="-includes=${INPUT_SOURCE_FILES}" | ||||||
| fi | ||||||
|
|
||||||
| if [ -n "$INPUT_SOURCE_FILES" ]; then | ||||||
| java -jar /lib/codenarc-all.jar \ | ||||||
| -report="${INPUT_REPORT:-compact:stdout}" \ | ||||||
| -rulesetfiles="${INPUT_RULESETFILES}" \ | ||||||
| -basedir="." \ | ||||||
| -includes="${INPUT_SOURCE_FILES}" \ | ||||||
| > result.txt | ||||||
| else | ||||||
| echo "🔍 Executando CodeNarc..." | ||||||
| java -jar /lib/codenarc-all.jar \ | ||||||
| -report="${INPUT_REPORT:-compact:stdout}" \ | ||||||
| -rulesetfiles="${INPUT_RULESETFILES}" \ | ||||||
| > result.txt | ||||||
| fi | ||||||
|
|
||||||
| -report="$report" \ | ||||||
| -rulesetfiles="${INPUT_RULESETFILES}" \ | ||||||
| -basedir="." \ | ||||||
| $includes_arg \ | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [shellcheck (suggestion)] reported by reviewdog 🐶
Suggested change
|
||||||
| > result.txt | ||||||
| } | ||||||
|
|
||||||
| < result.txt reviewdog -efm="%f:%l:%m" -efm="%f:%r:%m" \ | ||||||
| run_reviewdog() { | ||||||
| echo "📤 Enviando resultados para reviewdog..." | ||||||
| < result.txt reviewdog -efm="%f:%l:%m" -efm="%f:%r:%m" \ | ||||||
| -name="codenarc" \ | ||||||
| -reporter="${INPUT_REPORTER:-github-pr-check}" \ | ||||||
| -filter-mode="${INPUT_FILTER_MODE}" \ | ||||||
| -fail-on-error="${INPUT_FAIL_ON_ERROR}" \ | ||||||
| -level="${INPUT_LEVEL}" \ | ||||||
| ${INPUT_REVIEWDOG_FLAGS} | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [shellcheck (suggestion)] reported by reviewdog 🐶
Suggested change
|
||||||
| } | ||||||
|
|
||||||
| check_blocking_rules() { | ||||||
| echo "🔎 Verificando violacoes bloqueantes (priority 1)..." | ||||||
|
|
||||||
| p1_count=$(grep -Eo "p1=[0-9]+" result.txt | cut -d'=' -f2 | head -1) | ||||||
| p1_count=${p1_count:-0} | ||||||
|
|
||||||
| echo "📊 Resumo CodeNarc → priority 1=${p1_count}" | ||||||
|
|
||||||
| if [ "$p1_count" -gt 0 ]; then | ||||||
| echo "⛔ Foram encontradas violacoes bloqueantes (priority 1)." | ||||||
| echo "💡 Corrija as violacoes ou use o bypass autorizado pelo coordenador." | ||||||
| exit 1 | ||||||
| else | ||||||
| echo "✅ Nenhuma violacao bloqueante (priority 1) encontrada." | ||||||
| fi | ||||||
| } | ||||||
|
|
||||||
| if [ -n "${GITHUB_WORKSPACE}" ]; then | ||||||
| cd "${GITHUB_WORKSPACE}/${INPUT_WORKDIR}" || exit | ||||||
| git config --global --add safe.directory "$GITHUB_WORKSPACE" | ||||||
| fi | ||||||
|
|
||||||
| export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}" | ||||||
|
|
||||||
| run_codenarc | ||||||
| run_reviewdog | ||||||
| check_blocking_rules | ||||||
|
|
||||||
| rm result.txt | ||||||
| echo "🏁 Finalizado com sucesso." | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086