Skip to content

feat(cli): add per-check timing and total execution time - #140

Merged
Alberto-Codes merged 6 commits into
mainfrom
feat/cli-20-2-per-check-timing
Feb 26, 2026
Merged

feat(cli): add per-check timing and total execution time#140
Alberto-Codes merged 6 commits into
mainfrom
feat/cli-20-2-per-check-timing

Conversation

@Alberto-Codes

Copy link
Copy Markdown
Owner

Previously docvet check provided no visibility into how long each check
took or total execution time, making it hard to identify slow checks or
understand overall performance.

  • Add per-check timing to stderr when --verbose is set (e.g., enrichment: 42 files in 0.3s)
  • Add total execution time to stderr unconditionally (e.g., Completed in 1.2s)
  • Apply total timing to all four individual subcommands (enrichment, freshness, coverage, griffe)
  • Suppress griffe timing line when griffe is not installed to avoid contradictory output

Test: uv run pytest -v

Closes #24

test(cli): add timing unit tests and update no-findings tests
docs(cli): add story 20.2 implementation record


PR Review

Checklist

  • Self-reviewed my code
  • Tests pass (uv run pytest)
  • Lint passes (uv run ruff check .)
  • Types pass (uv run ty check)
  • Breaking changes use ! in title and BREAKING CHANGE: in body

Review Focus

  • Timing instrumentation in check() adds 4 if verbose: blocks — linear, no nesting, CC stays well under 15
  • importlib.util.find_spec("griffe") called in both check() and _run_griffe — by design (timing wraps calls, doesn't modify _run_* bodies)
  • Test hermeticity: _mock_check_internals fixture mocks find_spec so tests don't depend on griffe being installed

Related

Adjust 7 tests that asserted empty output to filter out the
"Completed in" timing line, keeping them compatible with the
upcoming per-check timing feature.
14 tests covering per-check timing (verbose only), total execution
time (unconditional), individual subcommand timing, format
validation, and griffe skip guard.
Fix 5 code review findings: mock find_spec for hermetic tests, assert
exact timing line counts, add elapsed value verification test, split
compound assert, and extract _non_timing_lines() helper in test_cli.py.
Mark story 20.2 and epic 20 as done.
@Alberto-Codes
Alberto-Codes marked this pull request as ready for review February 26, 2026 17:35
Copilot AI review requested due to automatic review settings February 26, 2026 17:35
@codecov-commenter

codecov-commenter commented Feb 26, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds timing instrumentation to the docvet CLI to make check performance visible, aligning with Epic 20 / Issue #24 (timing output for checks).

Changes:

  • Add per-check timing output for docvet check (only when --verbose is set).
  • Add total execution time output (Completed in …) for check and each individual subcommand.
  • Add/adjust unit tests to validate timing output and update “no output” assertions to ignore timing lines.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/docvet/cli.py Implements per-check and total timing output for check and total timing for each subcommand; adds griffe timing suppression when griffe is not installed.
tests/unit/test_cli_timing.py New unit tests covering timing presence/absence, formatting, and griffe-installed vs not-installed behavior.
tests/unit/test_cli.py Updates “no findings produces no output” assertions to ignore the new Completed in … line.
_bmad-output/implementation-artifacts/sprint-status.yaml Updates sprint tracking status/metadata.
_bmad-output/implementation-artifacts/20-2-per-check-timing-and-total-execution-time.md Adds story implementation record and AC-to-test mapping for Story 20.2.

Comment thread src/docvet/cli.py
Comment thread src/docvet/cli.py
Comment thread src/docvet/cli.py
Comment thread src/docvet/cli.py
Comment thread tests/unit/test_cli_timing.py Outdated
Comment thread src/docvet/cli.py
Comment thread src/docvet/cli.py
Remove _timing_lines() and _total_lines() — defined but never called.
Tests use TIMING_LINE_RE.findall() directly.
@Alberto-Codes
Alberto-Codes merged commit 56c6c62 into main Feb 26, 2026
8 checks passed
@Alberto-Codes
Alberto-Codes deleted the feat/cli-20-2-per-check-timing branch February 26, 2026 17:46
Alberto-Codes added a commit that referenced this pull request Feb 26, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.4.0](v1.3.0...v1.4.0)
(2026-02-26)


### Features

* **ci:** add post-publish PyPI smoke test
([#134](#134))
([5b89f3d](5b89f3d))
* **cli:** add per-check timing and total execution time
([#140](#140))
([56c6c62](56c6c62)),
closes [#24](#24)
* **cli:** add progress bar for file processing
([#139](#139))
([0f5e5dd](0f5e5dd)),
closes [#24](#24)
* **discovery:** add trailing-slash and double-star pattern support
([3696e6a](3696e6a))
* **discovery:** add trailing-slash and double-star pattern support
([#137](#137))
([3696e6a](3696e6a))
* **docs:** add breadcrumb back-links to rule pages
([#136](#136))
([17e985b](17e985b))


### Bug Fixes

* **docs:** remove redundant f-string in rule_header macro
([17e985b](17e985b))


### Documentation

* **cli:** add story 20.2 implementation record
([56c6c62](56c6c62))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Add progress bars and timing output for check execution

3 participants