lunarmodules / luacov

LuaCov is a simple coverage analyzer for Lua code.
http://lunarmodules.github.io/luacov/
MIT License
300 stars 68 forks source link

Improve file name normalization #97

Closed dwenegar closed 2 years ago

dwenegar commented 2 years ago

I encountered a couple of problems when running luacov in a Linux and Windows mixed environment:

  1. stats files generated on Windows contain CRs that end appended to filenames generating warnings and errors when loading the stats file;
  2. stats files sometimes contain the same file name more than once, some times as a/b/c, other times as ./a/b/c causing an incorrect calculation of the coverage.

This PR addresses those two problems with the following changes:

  1. trailing space is stripped from file names when loading the stats file;
  2. real_name strips the ./ prefix from the input file name.