New validation for code coverage uploads in CodeScene’s CLI

Code coverage is a valuable metric in CodeScene that helps teams assess test effectiveness by showing which codebase parts are exercised. We’ve updated the cs-coverage CLI tool to add a guardrail against uploading irrelevant coverage data for branches not configured in your CodeScene project.

Why we made this change

Until recently, users could upload coverage reports for any branch (e.g., develop, staging, main) without issue. However, CodeScene only incorporates coverage for the specific branch configured in the project settings - coverage for other branches was silently ignored and never appeared in analyses.

This led to wasted CI/CD resources, confusion in pipelines (uploads “succeeded” but showed no effect), and teams unaware their coverage wasn’t contributing to CodeScene metrics. Customers reported successfully uploading for multiple branches, only to find no coverage data in the UI.

The update addresses this by explicitly notifying users when they upload for a non-configured branch, guiding them to proper usage without breaking workflows.

How the guardrail works

In the latest CLI versions (e.g., 1.0.89+), cs-coverage upload checks the current Git branch against the branch configured in your CodeScene project:

  • If the branch matches the configured one: Upload proceeds normally, and coverage is used in analysis.

  • If the branch does not match: The CLI emits a usage error message (e.g., “Usage error: It seems you upload for repo/branch that is not configured…”), but completes the upload with exit code 0. This keeps pipelines running while flagging the issue.​

The data is still accepted but won’t be used in analysis, just as before - the difference is now you’re informed.

Impact on your workflows

  • No breaking changes: Uploads continue to work; pipelines won’t fail. Coverage behaviour is unchanged - only configured branches contribute to analysis.

  • Improved transparency: You’ll see the usage error in logs, helping identify and fix misaligned pipelines (e.g., restrict uploads to the configured branch).​

  • Better resource use: Avoid sending coverage that CodeScene ignores, focusing efforts on analysed branches.

Some customers suggested changing “Usage error” to “Warning” for log monitoring. We intentionally keep it as an error because, from CodeScene’s view, this is incorrect usage - it guides you to align uploads with analysis configuration.​

Recommended next steps

To eliminate the usage error and ensure all coverage counts:

  • Upload coverage only for the branch configured in your CodeScene project.

  • For multiple branches, create separate projects (each with its own configured branch) and upload accordingly.

For full setup, usage, and CLI examples, refer to the official docs:

Need more help?

Contact support or post in the CodeScene Community with your CLI output, branch, and project details. For premium support, email sales@codescene.com.