lunarmodules / luacov

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

Add 'modules' option #31

Closed mpeterv closed 9 years ago

mpeterv commented 9 years ago

Added new option for mapping module names to files where there are located. Modules are specified in the same way as in rockspecs, with a shortcut for many submodules:

modules = {
   ["rock.*"] = "src/"
}

instead of

modules = {
   ["rock.foo"] = "src/rock/foo.lua",
   ["rock.bar"] = "src/rock/bar.lua",
   ...
}

Module names are converted to patterns and added to included list automatically. When reporting, "real" filenames (values in the modules table) are used instead of original paths pointing to wherever luarocks installed them. So this addresses moteus/luacov-coveralls#2.

hishamhm commented 9 years ago

Please don't use "path ending with a slash" as a criteria. It leads to bad UX (I'm thinking here of all the times I had to look at rsync documentation (and still messed up!) because paths ending with and without slash have different semantics). In pathnames "/usr/lib/" and "/usr/lib" are supposed to mean the same, so it would be very unobvious looking at the configuration that the trailing slash is important.

Could you make it so that the presence of a wildcard in the key means that the value is a directory prefix (not requiring a trailing slash)?

mpeterv commented 9 years ago

Sure, that makes much more sense, pushed a fix. Should I squash it with the first commit?

hishamhm commented 9 years ago

Should I squash it with the first commit?

Don't worry about it :)

hishamhm commented 9 years ago

Thank you!!

mpeterv commented 9 years ago

Great, thanks! What do you think about adding rockspecs option that would automatically import modules from a rockspec for even easier configuring?

hishamhm commented 9 years ago

Unfortunately that would only work with builtin-type recipes :\