Skip to content

Support for coverage overlays #5019

Open
@lancelet

Description

@lancelet

hpc overlays are a means to adjust code coverage reports produced by the hpc tool. Overlays can be used (for example) to prevent derived instances of Eq or Ord from being marked as un-tested.

Currently, using stack with coverage overlays is quite cumbersome due to the additional package hash that stack appends. The problems are described in some detail in this StackOverflow question.

To work-around these issues, I have used a very hacky build script which looks up the hash that stack appends to a package:
https://github.com/lancelet/raindrop/blob/f8597c4cb446095f5420f3d5f974b9773e751343/raindrop/coverage-build.sh#L15-L16
It then uses that hash to modify template coverage files so that they will work with hpc:
https://github.com/lancelet/raindrop/blob/f8597c4cb446095f5420f3d5f974b9773e751343/raindrop/coverage-overlay.txt
(Note the {{PACKAGE_HASH}}, which is substituted by the script.)

Needless to say, this is quite nasty, and has me questioning my use of both hpc and overlays in the first place. It would be great if Stack could maybe do one of the following:

  • Provide an easy way to get the hash appended to a package from the CLI tool. Maybe this already exists and I just haven't come across it yet?
  • Provide some form of in-built support for overlay files (both for hpc draft and hpc overlay). This strikes me as a lot more difficult, but extremely useful.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions