Closed mpeterv closed 9 years ago
I tested this PR a bit, without running any real tests, just by annotating source files with marker symbols showing which lines are to be filtered (https://gist.github.com/mpeterv/2f579f508eb725295d50), and comparing annotations made with different luacov versions. For LuaRocks codebase there are no changes, for other projects there are some improvements, e.g.: statements["if"] = function(state, loc)
is now correctly filtered out in Luacheck and element.env.randomize = function(...)
is now never filtered out in Busted (correct because one of indexing operations is pinned to the line).
Merged, thank you!
BTW, I just added you to the luacov committers team :)
@hishamhm great, thanks =)
In function declarations argument list never affects coverage. In this patch, arguments are simply removed during line simplification. Fixes exclusion rules not being properly applied when argument list spans several lines.
Follow up commit fixes an issue added in the first one - without argument lists
local function noop() end
matchedlocal <IDS>
exclusion rule. As a side effect function declarations with assignments to string literal indexes are properly excluded, e.g.a["b"] = function(...)
is filtered out.Added tests with samples of some of fixed issues.