Add coverage to dmdoc output

Closes #38.
This commit is contained in:
Tad Hardesty 2019-06-29 16:28:07 -07:00
parent 88f2c92810
commit 6b401ef5ef
2 changed files with 12 additions and 4 deletions

View file

@ -332,18 +332,22 @@ fn main() -> Result<(), Box<std::error::Error>> {
}
drop(progress);
print!("documenting {} modules, {} macros, ", modules.len(), macro_count);
let mut coverage = format!("{} modules, {} macros, ", modules.len(), macro_count);
if count == 0 {
println!("0 types");
use std::fmt::Write;
let _ = write!(coverage, "0 types");
} else {
println!(
use std::fmt::Write;
let _ = write!(coverage,
"{}/{}/{} types ({}%)",
substance_count,
types_with_docs.len(),
count,
(types_with_docs.len() * 100 / count)
(types_with_docs.len() * 1000 / count) as f32 / 10.
);
}
println!("documenting {}", coverage);
ALL_TYPE_NAMES.with(|all| {
all.borrow_mut().extend(types_with_docs.iter()
@ -375,6 +379,7 @@ fn main() -> Result<(), Box<std::error::Error>> {
filename: &env_filename,
world_name,
title,
coverage: &coverage,
git: Default::default(),
};
if let Err(e) = git_info(&mut env.git) {
@ -767,6 +772,7 @@ struct Environment<'a> {
filename: &'a str,
world_name: &'a str,
title: &'a str,
coverage: &'a str,
git: Git,
}

View file

@ -18,4 +18,6 @@
{{ macros::index_tree(elems=types) }}
{% endif %}
<p>Documented {{ env.coverage }}.</p>
{% endblock content %}