irongut/CodeCoverageSummary

Add precision option for reported percentages

irongut opened this issue · 0 comments

Feature Request

Reported percentages are rounded to whole numbers which can lead to confusion if a percentage is rounded up to apparently meet a threshold but the package is reported as failing to meet it because the calculation uses the full floating point number. A precision option would allow users to choose how many decimal places they wish to see.

Expected Behaviour

  • Percentages in results will be displayed with 0 - 2 decimal places depending on setting; default 0.
  • Setting negative values will result in 0 decimal places.
  • Setting precision higher than 2 will result in 2 decimal places.

Additional Context

Based on sample outputs different tools record metrics with different precision in the coverage file. The most common seems to be 4 decimal places, which translates to 2 decimal places for percentages. Consider rounding all values on reading to 4 decimal places or based on this setting.

Linked To

#68 Coverage percentage is wrong