fix: correct control flow bugs in reportit() and check_logic()#46
Draft
toddr-bot wants to merge 1 commit into
Draft
fix: correct control flow bugs in reportit() and check_logic()#46toddr-bot wants to merge 1 commit into
toddr-bot wants to merge 1 commit into
Conversation
- Replace exit() with return in reportit() for printhash, simulate, and empty-objects cases. checkit() already uses return for identical cases; the exit() calls prevented proper return code handling and broke library usage (e.g. SpamAssassin integration). - Replace next with return in check_logic(), which is a subroutine called from a loop — next in a sub produces "Exiting subroutine via next" warnings and is deprecated behavior. - Use numeric == instead of string eq for length comparisons in Core.pm preprocessing pipeline. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
What
Fix three categories of control flow bugs in Agent.pm and Core.pm.
Why
reportit()usedexit()wherecheckit()usesreturn()for identical cases (printhash, simulate, no objects). This terminates the process instead of returning a status code, breaking library consumers like SpamAssassin.check_logic()usednextinside a subroutine called from a loop — deprecated behavior that produces "Exiting subroutine via next" warnings underuse warnings.eqfor numeric length comparisons.How
exit 0/exit 1withreturn 1inreportit(), matchingcheckit()'s convention (0=spam, 1=ok, 2=error).nextwithreturnincheck_logic()— the early return after settingspam=0is the correct behavior for skipped objects.$clen eq 0and$clen eq $olento use==.Testing
t/control_flow.twith 4 subtests covering all fixed paths.🤖 Generated with Claude Code
Quality Report
Changes: 4 files changed, 132 insertions(+), 8 deletions(-)
Code scan: clean
Tests: passed (OK)
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline