Open killy971 opened 10 years ago
Implementing this may not be as simple as it seems, as we have to differentiate the lines that are Haskell code and the lines that are not (which would count in the coverage).
It may be a good idea to check how hpc works and see if something can be reused for this purpose.
Another way is to use a Haskell code parser (which one?). It is then a matter of using the same rules as hpc in order to determine which lines should be considered as "coverable" code.
Haskell code parser libraries: haskell-src-exts, ghc-parser
You can also publish a tip in readme on how to change test suite/application to trick hpc into including all source. See Databrary for an example.
Because of the way hpc works, the coverage data generated only covers the modules which were referenced directly (or transitively?) by the test suites that are run.
Because of this, modules which are not referenced because of lack of test are not considered into the total coverage calculation.
This problem can be solved by introducing a new command line option to specify the source folders. Then, hpc-coveralls will automatically include all the source files from the source tree, and the ones that are not included in the tix/mix data will be considered as not covered.