Enforce metric thresholds on pull requests

TL;DR You can now set thresholds on code health metrics reported by DeepSource on your repository and configure it to fail the check on a pull request if the metric falls below that threshold.

Background

A key feature of DeepSource that helps teams systemize their code clean and secure is the ability to fail a pull request if any issues are detected in the proposed changes. By making these checks mandatory on your version control system, such as GitHub, GitLab, or Bitbucket, you can ensure that even if you have existing code health issues in the repository, at least no new issues are being introduced.

DeepSource also helps you track several key metrics about your code, such as line coverage, branch coverage, and documentation coverage. While there was a way to set a threshold for these dependencies, there was no way to take concrete action on these metrics. With this release, we’ve made repository metrics and thresholds more actionable.

What’s new?

It’s now easier to set thresholds for metrics in the Metrics tab of the repository.

Adding a threshold for a metric

Once you’ve set a threshold, you can configure this threshold to fail an analysis run if the metric value falls below the threshold from the Settings tab.

Once you’ve finished the configuration, you’d see the card in each analysis run reflecting if the pull request meets the threshold criteria. If it doesn’t, and you’ve configured the pull request to fail, you’d see the corresponding check failing on your version control system.


We hope this update helps engineering teams gain more control over their quality gate configuration and makes it easier to ensure they’re always shipping clean and secure code. Please let us know if you have any feedback!