-
Notifications
You must be signed in to change notification settings - Fork 0
fix: implementa bloqueio inteligente de P1s apenas em linhas alteradas no CodeNarc #61
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
Merged
Conversation
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
Contributor
|
🏷️ [bumpr] |
felipeeffting
approved these changes
Dec 18, 2025
joasgarcia
requested changes
Dec 18, 2025
joasgarcia
left a comment
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.
Essa é uma mudança substancial no linter do CodeNarc e existem cenários faltantes:
- Precisa testar regras P2 e P1 no mesmo review
- Precisa testar regras customizadas para entender se existe algum impacto
- Precisa testar regras customizadas por nós
- Precisa testar regras que não possuem indicativo de linha (ou seja que são file-based) como PackageNameMatchesFilePath ou outras
joasgarcia
approved these changes
Dec 23, 2025
schuartzrussi
approved these changes
Dec 23, 2025
Contributor
|
🚀 [bumpr] Bumped! |
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
Problema resolvido: Action do CodeNarc falhava mesmo quando violações P1 estavam em código antigo (fora do diff), causando falsos bloqueios e falta de comentários visíveis na PR.
Solução implementada: Só bloqueia merge quando P1s estão em linhas efetivamente alteradas
Antes: CodeNarc encontrava P1 em linha 100 (código antigo) → Action falhava → Sem comentário visível → Confusão
Agora: CodeNarc encontra P1 em linha 100 (código antigo) → Action passa → Log: "P1s existem mas fora das linhas alteradas"
Cenários testados
PR que altera linha 21 mas tem P1 antiga na linha 100
✅ Resultado: Action passa, mostra que P1 existe mas não bloqueia
✅ Log claro: Distingue entre P1s em código novo vs antigo
https://github.com/asaasdev/asaas/pull/54530
Com nova violação: https://github.com/asaasdev/asaas/actions/runs/20312541126/job/58350039032?pr=54530
Sem nova violação (só existente): https://github.com/asaasdev/asaas/actions/runs/20312159438/job/58347192135?pr=54530
Novos cenários:
1. ✅ Regras P1 + P2 mistas com violação em linha alterada
2. ✅ Regras customizadas P1 com Grails 2
3. ✅ Regras file-based + implementação híbrida
4. ✅ Grails 2 específico
5. ✅ Grails 4+ específico
Validação de retrocompatibilidade
Observação: O exit será reabilitado após confirmar que a detecção está precisa e não há falsos positivos/negativos.