-
Notifications
You must be signed in to change notification settings - Fork 0
feat: adiciona suporte a identificacao de priority via violationMessage #63
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
base: main
Are you sure you want to change the base?
feat: adiciona suporte a identificacao de priority via violationMessage #63
Conversation
|
🏷️ [bumpr] |
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.
Pull request overview
This PR enhances the CodeNarc Action's priority-based blocking logic by adding priority markers ([P1], [P2]) to violation messages in rulesets, enabling precise identification of P1 violations in changed lines. Previously, the system incorrectly blocked merges when P1 violations existed anywhere in the project along with any violations (even P2) in the diff. Now, blocking only occurs when actual P1 violations are detected in modified code.
Changes:
- Added priority markers ([P1], [P2]) to all violation messages in the CodeNarc basic ruleset
- Updated blocking logic to filter violations by priority marker before checking if they affect changed lines
- Improved error messaging and logging for better debugging of P1 detection
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| testdata/test.groovy | Added test cases demonstrating P1 and P2 violations with inline comments |
| testdata/basic.xml | Expanded all rule definitions to include priority values and Portuguese violation messages with [P1]/[P2] markers |
| entrypoint.sh | Enhanced check_blocking_rules() to extract and filter by priority markers, improved logging, and added safety checks for Git operations |
| testdata/text.md | Removed test content (spelling test cases) |
| testdata/subdir/text.md | Removed test content |
Comments suppressed due to low confidence (2)
testdata/text.md:1
- Multiple spelling errors in removed test content: 'Determinisitic' should be 'Deterministic', and 'langauge' should be 'language'.
testdata/subdir/text.md:1 - Corrected spelling of 'Determinisitic' to 'Deterministic'.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
entrypoint.sh
Outdated
| if [ "$(cat "$VIOLATIONS_FLAG")" -eq 1 ]; then | ||
| echo "⛔ P1s existem E há violações em linhas alteradas" | ||
| echo "💡 Corrija as violacoes ou use o bypass autorizado pelo coordenador." | ||
| echo "⛔ P1 encontrada em linha/arquivo alterado" |
Copilot
AI
Jan 16, 2026
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.
The error message 'P1 encontrada' uses singular form, but there could be multiple P1 violations. Consider using plural 'P1s encontradas' or 'Violação(ões) P1 encontrada(s)' for accuracy.
| echo "⛔ P1 encontrada em linha/arquivo alterado" | |
| echo "⛔ Violação(ões) P1 encontrada(s) em linha/arquivo alterado(s)" |
| -report="$report" \ | ||
| -rulesetfiles="${INPUT_RULESETFILES}" \ | ||
| -basedir="." \ | ||
| $includes_arg \ |
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.
| -report="$report" \ | ||
| -rulesetfiles="${INPUT_RULESETFILES}" \ | ||
| -basedir="." \ | ||
| $includes_arg \ |
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 (suggestion)] reported by reviewdog 🐶
| $includes_arg \ | |
| "$includes_arg" \ |
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.
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.
Impacto
Ajustada a lógica de verificação de prioridade P1 no CodeNarc Action para identificar corretamente se uma violação P1 está no diff. Anteriormente, o sistema bloqueava incorretamente quando havia P1s no projeto e qualquer violação (mesmo P2) no diff. Agora, com a adição de [P1], [P2] nas violationMessage dos rulesets, o bloqueio é preciso e só ocorre quando P1s reais estão nas linhas alteradas.
Link da tarefa no JIRA
Cenários testados
✅ PRs com P1s fora do diff + P2s no diff → merge permitido (antes bloqueava incorretamente)
https://github.com/asaasdev/asaas/pull/55682
https://github.com/asaasdev/asaas/actions/runs/21074707957/job/60615663760?pr=55682
✅ PRs com P1s no diff → merge bloqueado
✅ PRs sem P1s → merge permitido