Skip to content

Improve output summary#2

Merged
j9t merged 10 commits into
mainfrom
improve-output-summary
May 14, 2026
Merged

Improve output summary#2
j9t merged 10 commits into
mainfrom
improve-output-summary

Conversation

@j9t
Copy link
Copy Markdown
Owner

@j9t j9t commented May 13, 2026

Summary by CodeRabbit

  • Changed
    • Enhanced end-of-section summaries to show both "with issues" and "clean" counts, improved link-count wording (e.g., "3 broken links"), added per-file link-check breakdowns, and repeat section numbers on multi-section summaries for easier scanning.
  • Tests
    • Added CLI tests to verify section-numbering behavior across check modes.
  • Documentation
    • Updated changelog for 1.3.1-beta.
  • Chores
    • Bumped package version to 1.3.1-beta.

Review Change Stack

j9t added 3 commits May 13, 2026 20:08
Updated output messages to provide detailed summaries, including counts of files with issues or cleaned files. Improved clarity and consistency in the display of file check results.

(This commit message was AI-generated.)

Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 06823afd-8c4a-47a2-a099-4d24bf5cc00b

📥 Commits

Reviewing files that changed from the base of the PR and between 214b362 and 1d52305.

📒 Files selected for processing (1)
  • bin/hihtml.js

Walkthrough

Bumps package to 1.3.1-beta, updates formatters to emit combined checked/clean summary lines (including broken-link counts and corrected pluralization), defers CLI printing into numbered or unnumbered sections via a sections accumulator, and adds tests for section numbering.

Changes

Enhanced Output Summary Formatting & CLI Sectioning

Layer / File(s) Summary
Formatter updates and helpers
src/lib/output.js
Validation, deprecation, link-check, and minification formatters use shared helpers (filesCount, filesSummary) to emit consolidated checked/clean summary lines; link-check final summary now includes broken-link counts with correct singular/plural wording.
CLI sections accumulator and printing
bin/hihtml.js
CLI now collects formatted check outputs into a sections array and renders them via sectionsPrint() (numbered when multiple); quiet-mode hint logic updated to inspect collected sections and sections are printed at short-circuit and exit points.
CLI output numbering tests
bin/hihtml.test.js
Adds tests asserting numbered sections when multiple checks run, no numbering when only links run, and full numbering for --all; cleans generated output.
Version bump and changelog
package.json, CHANGELOG.md
Version updated to 1.3.1-beta and changelog entry added describing the enhanced end-of-section summaries and wording fixes.

Sequence Diagram(s)

sequenceDiagram
  participant formatValidationResult
  participant formatDeprecationResult
  participant formatLinkCheckResult
  participant formatMinificationResult
  participant filesSummary
  participant CLISections as "bin/hihtml.js:sections"
  participant Console

  formatValidationResult->>filesSummary: request checked/clean summary
  formatDeprecationResult->>filesSummary: request checked/clean summary
  formatLinkCheckResult->>filesSummary: request checked/clean + broken count
  formatMinificationResult->>filesSummary: request filesCount string
  filesSummary->>CLISections: return formatted section strings
  CLISections->>Console: emit numbered/unnumbered sections
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • j9t/hihtml#1: Also modifies src/lib/output.js formatter functions (this PR changes runtime summary/output logic; that PR updates JSDoc/result typing).
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Improve output summary' is directly related to the main change: enhanced end-of-section output summaries across validation, deprecation, link-check, and minification results with improved formatting and structured output.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch improve-output-summary

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@CHANGELOG.md`:
- Line 11: Update the changelog entry to mention the link-check output summary
enhancement in addition to validation and deprecated markup checks: reference
that formatLinkCheckResult (in src/lib/output.js) now includes broken link
counts with singular/plural handling so the entry describes all three modified
formatters (formatValidationResult, formatDeprecatedMarkupResult, and
formatLinkCheckResult).

In `@src/lib/output.js`:
- Around line 169-171: The summaryBroken computation uses result.countBroken ===
0 && result.countFileErrors === 0 to decide success styling, causing a warning
style when countBroken === 0 but countFileErrors > 0; update the logic in
summaryBroken so it only checks result.countBroken (i.e. treat zero broken links
as success regardless of file errors) and call s.success when result.countBroken
=== 0, otherwise s.warning with the count and pluralization; modify the code
that sets summaryBroken (and not summaryFileErrors) so file-error presence no
longer forces warning styling for broken-links.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3a724d15-e114-46d7-94af-bef6c70add5a

📥 Commits

Reviewing files that changed from the base of the PR and between f5481f2 and b784057.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (3)
  • CHANGELOG.md
  • package.json
  • src/lib/output.js

Comment thread CHANGELOG.md Outdated
Comment thread src/lib/output.js
j9t added 4 commits May 13, 2026 20:18
Replaced repetitive file summary logic with reusable helper functions (`filesCount` and `filesSummary`). This improves code readability, reduces redundancy, and ensures consistent output formatting across all file validation and reporting functions.

(This commit message was AI-generated.)

Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
Revised the output generation logic to consolidate sections into arrays, ensuring cleaner and more modular handling of outputs. Added functionality to number sections when multiple are displayed, improving readability and clarity in reports.

(This commit message was AI-generated.)

Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
Adjusted the regex in the output formatting logic to account for cases with double newlines before summaries. This ensures consistent handling of titles and summaries, improving overall output clarity.

(This commit message was AI-generated.)

Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@bin/hihtml.test.js`:
- Around line 395-403: The "Numbers all sections" test is nested inside another
test callback; cut the entire test block starting with test('Numbers all
sections', ...) and paste it as a top-level sibling test (i.e., not inside any
other test() callback) so it runs independently under node:test; keep the
existing assertions (assert.ok checks), the call to run([...]) and the cleanup
fs.rmSync call, and ensure it references the same helpers/variables (run,
tempDir, path) as before.

In `@src/lib/output.js`:
- Around line 153-155: The summary currently counts all entries in withIssues
(used to build fileParts) which includes files that only had skipped links;
change the logic so the summary counts only true-issue files by replacing use of
withIssues.length with a filtered count (e.g., count entries in withIssues that
are not skipped-only) before pushing the warning into fileParts; keep cleanCount
and fileParts as-is but reference the filtered issues count when creating the
`${...} with issues` message (use the existing withIssues identifier and the
property that marks skipped-only files, e.g., skippedOnly or
hasOnlySkippedLinks).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: e994f488-3391-4f68-a499-c1328117088b

📥 Commits

Reviewing files that changed from the base of the PR and between b784057 and aa15675.

📒 Files selected for processing (4)
  • CHANGELOG.md
  • bin/hihtml.js
  • bin/hihtml.test.js
  • src/lib/output.js

Comment thread bin/hihtml.test.js Outdated
Comment thread src/lib/output.js Outdated
j9t added 2 commits May 13, 2026 20:52
Relocated the "Numbers all sections" test to follow the correct cleanup logic within the test suite. This improves structure and ensures tests run in the intended sequence without unnecessary duplication.

(This commit message was AI-generated.)

Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
Replaced `cleanCount` with `countClean` and introduced `countIssues` to enhance clarity and consistency in file issue reporting. Updated corresponding output logic for better readability and maintainability.

(This commit message was AI-generated.)

Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
src/lib/output.js (1)

99-103: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix clean-count baseline in link summary.

Line 102 computes countClean from withIssues.length, but withIssues includes skipped-only files. That makes skipped-only files count as neither “with issues” nor “clean”, and can produce an empty middle summary segment on Line 163.

💡 Minimal fix
-  const countClean = result.files.length - withIssues.length;
+  const countClean = result.files.length - countIssues;

Also applies to: 156-163

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/lib/output.js` around lines 99 - 103, The clean-count calculation is
wrong because withIssues includes skipped-only files; compute countIssues as you
already do, then compute countSkipped (e.g., from result.files.filter(f =>
f.skipped).length) and set countClean = result.files.length - countIssues -
countSkipped; update the summary rendering that uses countClean (the link
summary segment generation) so it uses this corrected countClean value instead
of subtracting withIssues.length.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@src/lib/output.js`:
- Around line 99-103: The clean-count calculation is wrong because withIssues
includes skipped-only files; compute countIssues as you already do, then compute
countSkipped (e.g., from result.files.filter(f => f.skipped).length) and set
countClean = result.files.length - countIssues - countSkipped; update the
summary rendering that uses countClean (the link summary segment generation) so
it uses this corrected countClean value instead of subtracting
withIssues.length.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3c33f1ba-b84c-4932-8cba-6c8699982d70

📥 Commits

Reviewing files that changed from the base of the PR and between aa15675 and 214b362.

📒 Files selected for processing (2)
  • bin/hihtml.test.js
  • src/lib/output.js

Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
@j9t j9t merged commit 523d716 into main May 14, 2026
8 checks passed
@j9t j9t deleted the improve-output-summary branch May 14, 2026 06:50
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.

1 participant