Skip to content

[Code Quality] Fix ESLint require-return-after-core-setfailed: braceless if/else bypass #45405

Closed as not planned

Description

@github-actions

Description

The require-return-after-core-setfailed ESLint rule has a soundness gap: it only scans statement lists (BlockStatement.body, SwitchCase.consequent, Program.body), so braceless if/else/loop consequents like:

if (bad) core.setFailed("x"); doMore();  // NOT caught by rule

...are never checked, while braced equivalents are correctly caught. Although there are currently 0 live braceless sites, this is a latent soundness gap that will silently miss real violations as the codebase grows.

Suggested Changes

  • Update require-return-after-core-setfailed rule implementation to handle braceless consequents in IfStatement, ElseStatement, and loop bodies
  • Add test cases to the rule's test suite covering braceless if with setFailed without a following return
  • Verify the existing test cases still pass

Files Affected

  • actions/setup/js/ — ESLint rule source for require-return-after-core-setfailed
  • Corresponding test file for this rule

Success Criteria

  • Braceless if (cond) core.setFailed(msg); continueExecution(); is flagged by the rule
  • Braced-with-return case remains a true negative
  • All existing rule tests pass

Source

Extracted from ESLint Refiner Daily Report #45388

Priority

Medium — Latent soundness gap; low current risk but will silently grow

🔍 Task mining by Discussion Task Miner - Code Quality Improvement Agent · 205.3 AIC · ⌖ 5.26 AIC · ⊞ 7K · ◷

  • expires on Jul 14, 2026, 11:37 PM UTC-08:00

Activity

  1. github-actions commented on Jul 15, 2026

    @github-actions
    ContributorAuthor

    This issue was automatically closed because it expired on 2026-07-15T07:37:05.011Z.

    Closed by Workflow

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions