aantron / bisect_ppx

Code coverage for OCaml and ReScript
http://aantron.github.io/bisect_ppx/demo/
MIT License
302 stars 60 forks source link

Add `--sort-by-stats` flag to html reporter #433

Closed mbarbin closed 8 months ago

mbarbin commented 8 months ago

In this pull request, I have added a --sort-by-stats flag to the html-report command. This flag provides an option for users to order the files in the index page of the report by their coverage statistics in ascending order.

I have also ensured that this new flag works in conjunction with the existing --tree option : when both --sort-by-stats and --tree flags are used, the directories, as well as the files within each directory, are sorted by coverage statistics.

This addition is intended to offer a different perspective for developers who are working on improving coverage in existing codebases. By presenting files with lower coverage at the top, this option could potentially assist in prioritizing areas that may benefit from additional testing.

Note on Code Formatting

I encountered some difficulties to fmt the code due to issues finding a compatible combination of dependencies with opam. Despite trying several OCaml switches ranging from 4.05 to 5.1, I was unsuccessful. The ocamlformat.0.16.0 version seems to be outdated. Any assistance in resolving this issue would be greatly appreciated!

Looking forward to your feedback!

aantron commented 8 months ago

Thank you!

Bisect_ppx doesn't use dune fmt for the source code. It only uses ocamlformat for sanitizing test output.

mbarbin commented 8 months ago

Thank you for merging, and for the style changes. Much appreciated :smiley: