Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Heptazhou committed Sep 20, 2023
1 parent f077b32 commit b4b1bc8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"copyrightInserter.useLineComment": true
}
33 changes: 25 additions & 8 deletions main.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# Copyright (C) 2022-2023 Heptazhou <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

const bool(s::AbstractString) = parse(Bool, s)

using Pkg
Expand All @@ -12,17 +27,19 @@ file = get(ENV, "INPUT_LCOV_FILE", "lcov.info")
keep = get(ENV, "INPUT_LCOV_KEEP", "1") |> bool
skip = get(ENV, "INPUT_SKIP_MISS", "0") |> bool

dirs = filter!(!isempty, split(dirs, r":|\n"))
skip && filter!(ispath, dirs)
for dir in dirs
isdir(dir) || error("`$dir` is not a directory")
end
isdir(file) && error("`$file` is a directory")
dirs =
filter!(!isempty, split(dirs, r":|\n"))
skip &&
filter!(ispath, dirs)
filter(!isdir, dirs) .|> dir ->
error("`$dir` is not a directory")
isdir(file) &&
error("`$file` is a directory")

fcs = keep && isfile(file) ? LCOV.readfile(file) : vcat(process_folder.(dirs)...)
fcs = keep && isfile(file) ? LCOV.readfile(file) : mapreduce(process_folder, vcat, dirs)
LCOV.writefile(file, fcs)

cvr, tot = get_summary(fcs)
pct = round(100cvr / tot, digits = 2)
pct = round(100cvr // tot, digits = 2)
@info "$cvr / $tot ($pct%)"

0 comments on commit b4b1bc8

Please sign in to comment.