diff options
author | Mateusz Czaplinski <mateusz@czaplinski.pl> | 2011-05-30 21:02:24 +0200 |
---|---|---|
committer | Mateusz Czaplinski <mateusz@czaplinski.pl> | 2011-05-30 21:02:24 +0200 |
commit | e2adeb9e242ae2824500acf2a3410c10fd2ebb81 (patch) | |
tree | c9b2434be2d6a9eb9f3fc61224b002126a8fb786 | |
parent | 819ffb727005b8093000579745074e61d12f0c17 (diff) | |
download | luacov-e2adeb9e242ae2824500acf2a3410c10fd2ebb81.tar.gz |
luacov/stats.lua: expanded one-line if-blocks for easier reading
-rw-r--r-- | src/luacov/stats.lua | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/src/luacov/stats.lua b/src/luacov/stats.lua index 1e50eec..40f71e2 100644 --- a/src/luacov/stats.lua +++ b/src/luacov/stats.lua @@ -6,22 +6,35 @@ local stats function M.load() local data, most_hits = {}, 0 - local stats = io.open(statsfile, "r") - if not stats then return data end + stats = io.open(statsfile, "r") + if not stats then + return data + end while true do local nlines = stats:read("*n") - if not nlines then break end + if not nlines then + break + end local skip = stats:read(1) - if skip ~= ":" then break end + if skip ~= ":" then + break + end local filename = stats:read("*l") - if not filename then break end - data[filename] = {} - data[filename].max = nlines + if not filename then + break + end + data[filename] = { + max=nlines + } for i = 1, nlines do local hits = stats:read("*n") - if not hits then break end + if not hits then + break + end local skip = stats:read(1) - if skip ~= " " then break end + if skip ~= " " then + break + end if hits > 0 then data[filename][i] = hits most_hits = math.max(most_hits, hits) |