Skip to content

fix: ignore constant-return CLI main - #688

Open
ApexWorm wants to merge 1 commit into
peteromallet:mainfrom
ApexWorm:fix/cli-main-constant-return
Open

fix: ignore constant-return CLI main#688
ApexWorm wants to merge 1 commit into
peteromallet:mainfrom
ApexWorm:fix/cli-main-constant-return

Conversation

@ApexWorm

@ApexWorm ApexWorm commented Aug 1, 2026

Copy link
Copy Markdown

Problem

The constant-return detector flags ordinary CLI main entry points that return zero on every successful path, even when the function is invoked only through an exact module entrypoint guard. This produces a false positive for deployment scripts.

Fix

Recognize a top-level main invoked by an exact name module guard and exempt only that function from constant-return detection. Unguarded main functions, non-main guarded functions, and nested main functions remain detected.

Verification

  • 41 AST smell tests passed
  • 284 Python-language tests passed
  • The patched detector no longer flags the real deployment renderer main; the current detector does
  • Diff whitespace check passed
  • Ruff has the same pre-existing UP038 finding on base and branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant