feat(DVT-1005): corrige falsos positivos e exibe priority das violacoes CodeNarc#66
Merged
felipeeffting merged 19 commits intomainfrom Jan 26, 2026
Conversation
Contributor
|
🏷️ [bumpr] |
Wiz Scan SummaryDisplaying only findings that violated a policy
To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension. |
| name="$4" | ||
| filter_mode="$5" | ||
| level="$6" | ||
| $includes_arg >/dev/null 2>&1 |
Contributor
| -name="codenarc" \ | ||
| -filter-mode="${INPUT_FILTER_MODE}" \ | ||
| -level="${INPUT_LEVEL}" \ | ||
| ${INPUT_REVIEWDOG_FLAGS} >/dev/null || true |
Contributor
| -name="codenarc" \ | ||
| -filter-mode="${INPUT_FILTER_MODE}" \ | ||
| -level="${INPUT_LEVEL}" \ | ||
| ${INPUT_REVIEWDOG_FLAGS} >/dev/null || true |
Contributor
| -name="codenarc" \ | ||
| -filter-mode="nofilter" \ | ||
| -level="warning" \ | ||
| ${INPUT_REVIEWDOG_FLAGS} >/dev/null || true |
Contributor
| name="$4" | ||
| filter_mode="$5" | ||
| level="$6" | ||
| $includes_arg >/dev/null 2>&1 |
Contributor
There was a problem hiding this comment.
[shellcheck (suggestion)] reported by reviewdog 🐶
Suggested change
| $includes_arg >/dev/null 2>&1 | |
| "$includes_arg" >/dev/null 2>&1 |
| -name="codenarc" \ | ||
| -filter-mode="${INPUT_FILTER_MODE}" \ | ||
| -level="${INPUT_LEVEL}" \ | ||
| ${INPUT_REVIEWDOG_FLAGS} >/dev/null || true |
Contributor
There was a problem hiding this comment.
[shellcheck (suggestion)] reported by reviewdog 🐶
Suggested change
| ${INPUT_REVIEWDOG_FLAGS} >/dev/null || true | |
| "${INPUT_REVIEWDOG_FLAGS}" >/dev/null || true |
| -name="codenarc" \ | ||
| -filter-mode="${INPUT_FILTER_MODE}" \ | ||
| -level="${INPUT_LEVEL}" \ | ||
| ${INPUT_REVIEWDOG_FLAGS} >/dev/null || true |
Contributor
There was a problem hiding this comment.
[shellcheck (suggestion)] reported by reviewdog 🐶
Suggested change
| ${INPUT_REVIEWDOG_FLAGS} >/dev/null || true | |
| "${INPUT_REVIEWDOG_FLAGS}" >/dev/null || true |
| -name="codenarc" \ | ||
| -filter-mode="nofilter" \ | ||
| -level="warning" \ | ||
| ${INPUT_REVIEWDOG_FLAGS} >/dev/null || true |
Contributor
There was a problem hiding this comment.
[shellcheck (suggestion)] reported by reviewdog 🐶
Suggested change
| ${INPUT_REVIEWDOG_FLAGS} >/dev/null || true | |
| "${INPUT_REVIEWDOG_FLAGS}" >/dev/null || true |
felipeeffting
approved these changes
Jan 26, 2026
Contributor
|
🚀 [bumpr] Bumped! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Impacto
Esta alteração corrige falsos positivos no bloqueio de merge do
codenarc-actione aprimora a exibição da prioridade das violações do CodeNarc nos logs.Problema anterior:
compactdo CodeNarc não fornecia a prioridade individualmente.Solução implementada:
priority) de cada violação.jqfoi integrado para extrair seletivamente as violações de Prioridade 1 (P1) do relatório JSON e formatá-las em um output compacto.[P1],[P2],[P3], facilitando a identificação e a depuração.reviewdogprocessa o output formatado (agora contendo a prioridade) utilizandoerrorformat(-efm). Violações baseadas em linha são reportadas comogithub-pr-reviewe violações baseadas em arquivo comogithub-pr-check.Observação sobre SARIF:
A utilização do formato SARIF do CodeNarc, embora inicialmente considerada e um padrão mais robusto, foi adiada. O suporte a SARIF no CodeNarc é uma funcionalidade muito recente (implementada na branch
mastere sem uma versão estável/tag liberada no momento). Para garantir a estabilidade e evitar dependências em funcionalidades instáveis, optou-se por uma abordagem alternativa robusta que atinge os mesmos objetivos de precisão e exibição de prioridade, utilizando as versões estáveis existentes do CodeNarc e Reviewdog.Link da tarefa no JIRA
https://asaas.atlassian.net/browse/DVT-1005
Mudanças técnicas:
3.6.0-groovy3.0.23. A configuração de output foi alterada paraJSONpara incluir apriorityde cada violação.v0.13.0. A integração é feita viaerrorformat(-efm), sem a necessidade de suporte direto a SARIF.jqpara o parseamento do JSON do CodeNarc. O scriptentrypoint.shtevechmod +xadicionado.entrypoint.sh:convert_json_to_compactque utilizajqpara formatar o JSON em um formato legível, incluindo a prioridade ([P1]).check_blocking_rulesfoi revisada para extrair apenas P1s do JSON, verificar sua presença em linhas alteradas e bloquear o merge de forma precisa.reviewdogé alimentado foi adaptada para o formato compacto (errorformat).Cenários testados
✅ Bloqueio correto (sem falsos positivos)
Cenário 1: P1 fora do diff + P2 dentro → NÃO deve bloquear ✅
https://github.com/asaasdev/test-workflows-run/pull/907
https://github.com/asaasdev/test-workflows-run/actions/runs/21264924084/job/61290272849?pr=907
Cenário 2: P1 dentro do diff → DEVE bloquear ❌
https://github.com/asaasdev/test-workflows-run/pull/908
https://github.com/asaasdev/test-workflows-run/actions/runs/21265632030/job/61290264034?pr=908
Cenário 3: Apenas P2 → NÃO deve bloquear ✅
https://github.com/asaasdev/test-workflows-run/pull/914
https://github.com/asaasdev/test-workflows-run/actions/runs/21293863565/job/61294428119?pr=914
Cenário 4: Violação file-based (PackageName) → Detectar corretamente
https://github.com/asaasdev/test-workflows-run/pull/915
https://github.com/asaasdev/test-workflows-run/actions/runs/21293864534/job/61294431297?pr=915
https://github.com/asaasdev/test-workflows-run/runs/61294483610
Cenário 5: Múltiplas P1 - algumas dentro, outras fora do diff → DEVE bloquear ❌
https://github.com/asaasdev/test-workflows-run/pull/916
https://github.com/asaasdev/test-workflows-run/actions/runs/21293865641/job/61294435683?pr=916
Cenário 6: Modo local (sem git diff)
✅ Logs exibem priority
[P1],[P2],[P3]arquivo:linha:Regra Mensagem [PX]✅ Reviewdog funciona
github-pr-review)github-pr-check)-reporter=local✅ Casos especiais