Back to all posts
Apr 27, 2023
ENTERPRISE SERVER v3.20.0

Metric Thresholds for New Code

Teams usually want to create separate quality gates for the existing code and new code being added in a pull request. This helps keeping the bar strict for new changes but a little more relaxed for existing code that could have technical debt you don’t want to deal with immediately. On DeepSource, you can now set quality gates for new code based for metricss like Line Coverage, Branch Coverage, and Composite Coverage.

To set a threshold for new code, go to the Metrics tab on your repository dashboard, select the desired metric, and set the desired threshold.

New in Analyzers

  • We’ve added five new checks in this release:

Fixes and Improvements

  • We’ve fixed an issue where Autofix™️ was failing in PTC-W0049, which pertains to functions or methods with an empty body when using the ... syntax.
  • We’ve fixed an issue in the Java Analyzer where checks were not properly deduplicated, leading to multiple reports of the same check at the same location.
  • We’ve fixed several false positives in this release:
  • PY-W0074, PY-W0075: We’ve fixed an issue where the Analyzer was incorrectly suggesting the use of an all statement when an inner if statement had an else clause.
  • PYL-W0612: We’ve fixed an issue where the Analyzer was incorrectly reporting unused variables found when a variable was defined inside pytest.raises() block.
  • PYL-W0125: We’ve fixed an issue where the Analyzer was incorrectly flagging a conditional statement in a list comprehension as being used with a constant value when in fact, the conditional statement was using a @cached_property as the if-clause.
  • PYL-E0102: We’ve fixed an issue where the Analyzer was incorrectly flagging methods as being redefined when using the multipledispatch package to overload functions. The issue arose because the methods had different parameter sets, but the Analyzer was not accounting for this.
  • PY-W0069: We’ve fixed an issue where the Analyzer was incorrectly suggesting to remove the commented-out code block for comments like # --- Tests and helper.
  • CS-W1082: We’ve fixed an issue where the Analyzer was incorrectly flagging consecutive assignments as unused.
  • SC-R1061: We’ve fixed an issue where the Analyzer was not correctly taking into account the mutability of variables when compound operators, such as the += operator, were used.