Skip to content

Commit

Permalink
feat: More stats
Browse files Browse the repository at this point in the history
  • Loading branch information
jstoobysmith committed Nov 11, 2024
1 parent 1c303f8 commit 63fcbf3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
15 changes: 15 additions & 0 deletions HepLean/Meta/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -175,4 +175,19 @@ def noInformalDefs : MetaM Nat := do
let x := x.filter (Informal.isInformalDef)
pure x.toList.length

/-- The number of TODO items. -/
def noTODOs : IO Nat := do
let imports ← HepLean.allImports
let x ← imports.mapM HepLean.Imports.getLines
let x := x.flatten
let x := x.filter fun l => l.startsWith "/-! TODO:"
pure x.size

/-- The number of files with a TODO item. -/
def noFilesWithTODOs : IO Nat := do
let imports ← HepLean.allImports
let x ← imports.mapM HepLean.Imports.getLines
let x := x.filter (fun M => M.any fun l => l.startsWith "/-! TODO:")
pure x.size

end HepLean
9 changes: 7 additions & 2 deletions scripts/stats.lean
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ unsafe def Stats.toHtml : MetaM String := do
let noLinesVal ← noLines
let noInformalDefsVal ← noInformalDefs
let noInformalLemmasVal ← noInformalLemmas
let noTODOsVal ← noTODOs
let noFilesWithTODOsVal ← noFilesWithTODOs
let header := "---
layout: default
---
Expand Down Expand Up @@ -83,14 +85,17 @@ layout: default
<h3>Number of Definitions (incl. instances): {noDefsVal - noInformalLemmasVal}</h3>
<p>- Of which {noDefsVal - noDefsNoDocVal- noInformalLemmasVal} have doc-strings:</p>
<progress value=\"{noDefsVal - noDefsNoDocVal- noInformalLemmasVal}\" max=\"{noDefsVal- noInformalLemmasVal}\"></progress>
<p>- Of which {noDefsVal - noInformalLemmasVal - noInformalDefsVal} are not informal definitions:</p>
<p>- Of which {noDefsVal - noInformalLemmasVal - noInformalDefsVal} are not <a href=\"https://heplean.github.io/HepLean/InformalGraph.html\">informal definitions</a>:</p>
<progress value=\"{noDefsVal - noInformalLemmasVal - noInformalDefsVal}\" max=\"{noDefsVal - noInformalLemmasVal}\"></progress>
<h3>Number of Lemmas: {noLemmasVal + noInformalLemmasVal}</h3>
<p>- Of which {noLemmasVal - noLemmasNoDocVal + noInformalLemmasVal} have doc-strings:</p>
<progress value=\"{noLemmasVal - noLemmasNoDocVal + noInformalLemmasVal}\" max=\"{noLemmasVal + noInformalLemmasVal}\"></progress>
<p>- Of which {noLemmasVal} are not informal lemmas:</p>
<p>- Of which {noLemmasVal} are not <a href=\"https://heplean.github.io/HepLean/InformalGraph.html\">informal lemmas</a>:</p>
<progress value=\"{noLemmasVal}\" max=\"{noLemmasVal + noInformalLemmasVal}\"></progress>
<h3>Number of <a href=\"https://heplean.github.io/HepLean/TODOList\">TODOs</a>: {noTODOsVal}</h3>
<p>- There are {noImportsVal - noFilesWithTODOsVal} (of {noImportsVal}) files which are TODO free:</p>
<progress value=\"{noImportsVal - noFilesWithTODOsVal}\" max=\"{noImportsVal}\"></progress>
"
let footer := "
</body>
Expand Down

0 comments on commit 63fcbf3

Please sign in to comment.