Skip to content

[Feature Request]: Add missing exit-code propagation to scripts/static_checks.sh #6259

Description

@Sandesh282

Is your feature request related to a problem? Please describe.

scripts/static_checks.sh is the local "run all checks" convenience script. However, when an individual check fails (e.g., ktlint_lint_check.sh exits with code 1), the outer script currently continues running the next check and ultimately exits with the status of the last command, not the first failure. This means a developer could see "finished" at the end while a check in the middle silently failed.

The fix is to track failures across all checks and exit with a non-zero code if any of them failed, matching CI behavior.

Describe the solution you'd like

Update scripts/static_checks.sh to track failures across all checks and exit with a non-zero code if any of them failed, while still running all checks to completion (not bailing on the first failure).

Concretely:

  • Add a FAILURES=0 counter at the top of the script.
  • After each check invocation, append || FAILURES=$((FAILURES+1)) to capture failures without stopping execution.
  • At the very end of the script, exit with a non-zero code if FAILURES > 0 and print a clear summary, e.g.:
    • 2 check(s) failed. Please fix the above errors.
    • All checks passed.

This matches how CI behaves: all checks run, and the job reports overall failure if any individual step failed.

Describe alternatives you've considered

Using set -e at the top of the script would bail on the first failure and skip remaining checks, which is worse UX for a developer who wants to fix all issues in one pass. The failure-counter approach is strictly better.

Additional context

Files involved:

  • scripts/static_checks.sh (only file that needs to change)

The fix is ~10 lines of Bash. A contributor can verify correctness by:

  1. Introducing a deliberate lint error (e.g. a trailing space in a .kt file).
  2. Running bash scripts/static_checks.sh.
  3. Confirming the script completes all remaining checks AND exits with code 1.

Related: scripts/pre-push.sh already has a similar pattern worth referencing.

Metadata

Metadata

Assignees

Labels

Impact: MediumModerate perceived user impact (non-blocking bugs and general improvements).Work: LowSolution is clear and broken into good-first-issue-sized chunks.enhancementEnd user-perceivable enhancements.good first issueThis item is good for new contributors to make their pull request.

Projects

Status
Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions