Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8ab83edc73 |
@@ -12,6 +12,9 @@
|
|||||||
|
|
||||||
The CI badge shows the last completed attempt for this branch while newer
|
The CI badge shows the last completed attempt for this branch while newer
|
||||||
runs are queued. Badge SVGs are stored in a private, machine-maintained branch.
|
runs are queued. Badge SVGs are stored in a private, machine-maintained branch.
|
||||||
|
The code-quality letter requires warnings-denied Clippy and measured test plus
|
||||||
|
UI self-test line coverage: A at 90%, B at 80%, C at 70%, D at 60%, and F
|
||||||
|
below 60%. A missing coverage measurement displays pending.
|
||||||
|
|
||||||
A cross-platform desktop toolkit for discovering, monitoring, and re-flashing
|
A cross-platform desktop toolkit for discovering, monitoring, and re-flashing
|
||||||
ASIC miners. It scans a fleet over the network, shows live health and hashrate
|
ASIC miners. It scans a fleet over the network, shows live health and hashrate
|
||||||
|
|||||||
+19
-2
@@ -11,6 +11,7 @@ Metrics not passed on the command line are computed here (LOC from the source
|
|||||||
tree, dependency count from Cargo.lock, license from Cargo.toml).
|
tree, dependency count from Cargo.lock, license from Cargo.toml).
|
||||||
"""
|
"""
|
||||||
import argparse
|
import argparse
|
||||||
|
import math
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
@@ -130,6 +131,17 @@ def cov_color(pct: float) -> str:
|
|||||||
return "red"
|
return "red"
|
||||||
|
|
||||||
|
|
||||||
|
def quality_grade(clippy: str, coverage: float | None) -> str:
|
||||||
|
if clippy != "clean":
|
||||||
|
return "F"
|
||||||
|
if coverage is None:
|
||||||
|
return "pending"
|
||||||
|
for minimum, grade in ((90, "A"), (80, "B"), (70, "C"), (60, "D")):
|
||||||
|
if coverage >= minimum:
|
||||||
|
return grade
|
||||||
|
return "F"
|
||||||
|
|
||||||
|
|
||||||
def human(n: int) -> str:
|
def human(n: int) -> str:
|
||||||
suffixes = ("", "K", "M", "G")
|
suffixes = ("", "K", "M", "G")
|
||||||
value = float(n)
|
value = float(n)
|
||||||
@@ -160,6 +172,9 @@ def main() -> int:
|
|||||||
ap.add_argument("--bench-delta", default=None)
|
ap.add_argument("--bench-delta", default=None)
|
||||||
ap.add_argument("--clippy", default="clean")
|
ap.add_argument("--clippy", default="clean")
|
||||||
args = ap.parse_args()
|
args = ap.parse_args()
|
||||||
|
for value in (args.coverage, args.bench_coverage):
|
||||||
|
if value is not None and (not math.isfinite(value) or not 0 <= value <= 100):
|
||||||
|
ap.error("coverage must be a finite percentage between 0 and 100")
|
||||||
|
|
||||||
os.makedirs(os.path.join(args.root, args.out), exist_ok=True)
|
os.makedirs(os.path.join(args.root, args.out), exist_ok=True)
|
||||||
|
|
||||||
@@ -176,8 +191,10 @@ def main() -> int:
|
|||||||
write("loc", "lines of code", human(loc), loc_color(loc))
|
write("loc", "lines of code", human(loc), loc_color(loc))
|
||||||
write("license", "license", lic, "blue")
|
write("license", "license", lic, "blue")
|
||||||
write("dependencies", "dependencies", str(deps), "blue")
|
write("dependencies", "dependencies", str(deps), "blue")
|
||||||
grade = "A" if args.clippy == "clean" else "F"
|
grade = quality_grade(args.clippy, args.coverage)
|
||||||
write("quality", "code quality", grade, "brightgreen" if grade == "A" else "red")
|
write("quality", "code quality", grade,
|
||||||
|
{"A": "brightgreen", "B": "yellowgreen", "C": "yellow",
|
||||||
|
"D": "orange", "F": "red", "pending": "lightgrey"}[grade])
|
||||||
if args.tests is not None:
|
if args.tests is not None:
|
||||||
write("tests", "tests", f"{args.tests} passing", "brightgreen")
|
write("tests", "tests", f"{args.tests} passing", "brightgreen")
|
||||||
if args.coverage is not None:
|
if args.coverage is not None:
|
||||||
|
|||||||
Reference in New Issue
Block a user