Select Git revision
path_in_pixels.csv
coverage.jl 1.60 KiB
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .jl
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.16.4
# kernelspec:
# display_name: Julia 1.10.2
# language: julia
# name: julia-1.10
# ---
# %% [markdown]
# # Prelude
# %%
import Pkg
Pkg.activate("..")
Pkg.instantiate()
# %%
using Coverage
using Base.Filesystem
# %% [markdown]
# # Run tests, Collecting stats
# %%
for (d, ds, fs) in walkdir("../src")
for f in fs
if endswith(f, ".cov")
rm("$(d)/$(f)")
end
end
end
# %%
Pkg.test("IQC"; coverage=true)
# %%
coverage = process_folder("../src") # defaults to src/; alternatively, supply the folder name as argument
coverage = [ c for c in coverage if !occursin("ipynb_checkpoints", c.filename) ];
# %% [markdown]
# # Per file summary statistics
# %%
for cov in coverage
good = length([ c for c in cov.coverage if !isnothing(c) && !iszero(c) ])
total = length([ c for c in cov.coverage if !isnothing(c) ])
println("$(split(cov.filename, "/")[end]): $(good)/$(total)")
end
# %% [markdown]
# # Untested Functions and Macros
# %%
re_macro = r"^macro .*"
re_function = r"^function .*"
re_function_short = r"^[A-Za-z0-9z.]*\(.*\).*="
# %%
for cov in coverage
println("File: $(cov.filename)")
for (c, ℓ) in zip(cov.coverage, split(cov.source, "\n"))
if isnothing(c) || iszero(c)
if occursin(re_macro, ℓ) || occursin(re_function, ℓ) || occursin(re_function_short, ℓ)
println(ℓ)
end
end
end
end
# %%
# %%