Skip to content

Add CLI exit status to allow build failures #124

@gidich

Description

@gidich

Problem

When using the CLI as part of automated build pipelines (such as running SonarCloud analysis from the command line, it's important that the CLI returns a non-zero exit status to signal build failure when appropriate. This is a standard approach used by most CLI tools to make error handling robust and predictable.

Request

Please update the CLI so that, when analysis returns results requiring remdiation, it exits with a non-zero status code. (the --log-level switch could be leveraged so that consumer determines which level would cause a non-zero exit code)

Context & Benefit

  • This functionality enables build systems and tools like the GitHub Copilot Agent to correctly detect failure and retry or halt workflows as needed.
  • It streamlines CI/CD, CI quality gates, and tool integrations, and brings the CLI behavior in line with best practices for command-line developer tooling.

References

  • Our use case is in the CellixJS/cellixjs repository where we run SonarCloud from the CLI and depend on exit codes to automate issue remediation.
  • This is a common pattern for many CLI tools (see npm, pnpm, yarn, etc.).

Thank you for considering this feature!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions