Skip to content

docs: reduce inline comments to why-only; move rationale into doc/#589

Merged
galbus merged 4 commits into
mainfrom
claude/reduce-inline-comments-cdbf3c
Jul 19, 2026
Merged

docs: reduce inline comments to why-only; move rationale into doc/#589
galbus merged 4 commits into
mainfrom
claude/reduce-inline-comments-cdbf3c

Conversation

@galbus

@galbus galbus commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

What

Drastically reduces the volume of inline comments and docblock prose across the plugin — src/, root PHP files, scripts/, tests/phpunit/ and tests/cypress/ — per the "code explains what, comments explain why" rule:

  • PHPDoc / JSDoc: 1-line summary; a secondary description (max 2 lines) only where behaviour is genuinely non-obvious. All @since / @param / @return / @var tags preserved with their existing values.
  • Inline comments: what-comments removed; why-comments kept, trimmed to 1–2 lines.
  • Functional comments untouched: phpcs:ignore/disable/enable, /* translators: */, eslint globals/disables, WordPress dependency section headers, the plugin header in speechkit.php, PHPUnit @test/@covers/@group/@dataProvider annotations, and Cypress @group/@covers spec-discovery headers.
  • WordPress hook docblocks (above apply_filters/do_action) kept as public API docs, descriptions trimmed to 1 line.

Long-form rationale worth keeping has moved to doc/ and is linked from the README documentation index:

  • doc/rest-meta-visibility.md — how BeyondWords post meta is exposed/hidden over REST
  • doc/video-settings-payload.md — why a full video_settings object is sent to the content endpoint
  • doc/preselect-generate-audio.md — stored format, legacy shapes, no-dirty editor derivation, save-time decision
  • doc/settings-internals.md — settings-error transport, API connection check contract
  • doc/wordpress-vip.md — new object-cache notes section
  • doc/running-tests.md — new PHPUnit/flaky-test lore sections
  • README now also links the previously unlisted async-rest-migration.md and legacy-meta-migration.md

No lines of code changed

Every one of the 139 changed PHP/JS files is code-identical to main: byte-identical php -w output (comments + whitespace stripped) for PHP, identical espree token streams (JSX-aware, comments excluded) for JS. Formatting around removals was also checked — no introduced trailing whitespace, double blank lines, or blank lines adjacent to braces (pattern counts compared per-file against main).

phpcs (WordPress-VIP-Go ruleset) and wp-scripts lint-js both pass.

Includes latest main

origin/main is merged in (including the bulk-generate cap from #573). The verbose docblocks/inline comments that feature added to Sync, BulkEdit, Notices and their tests were trimmed to the same style during the merge; conflict resolution kept main's code (new const + @param tags) with this branch's trimmed prose.

147 files changed, +1,027 / −2,694 (net −1,667; additions are almost entirely the new doc/ pages).

🤖 Generated with Claude Code

galbus and others added 3 commits July 19, 2026 11:46
…doc/

Comments-only change — no lines of code are touched (verified by comparing
php -w output and espree token streams for every file against the previous
commit).

- PHPDoc/JSDoc blocks now carry a 1-line summary, with a secondary
  description (max 2 lines) only where the behaviour is genuinely
  non-obvious. All @since/@param/@return/@var tags are preserved.
- Inline what-comments are removed; why-comments are kept and trimmed to
  1-2 lines.
- Functional comments are untouched (phpcs:ignore, translators, eslint
  globals, WP dependency headers, plugin header).
- Long-form rationale that was worth keeping now lives in doc/:
  rest-meta-visibility.md, video-settings-payload.md,
  preselect-generate-audio.md, settings-internals.md, plus additions to
  wordpress-vip.md — all linked from the README doc index.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Same rules as the src pass; @test/@covers/@group/@dataProvider annotations
and Cypress spec-discovery headers are untouched. Flaky-test lore moved to
doc/running-tests.md.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…t in

Conflicts in src/post/class-sync.php resolved by keeping main's code (the
new BULK_GENERATE_SYNC_LIMIT const and @param tags) with this branch's
trimmed prose. The docblocks/inline comments main's bulk-generate change
added to Sync, BulkEdit, Notices and their tests are trimmed to the same
why-only style. Post-merge, every PHP/JS file in the tree is code-identical
to origin/main (php -w / espree token comparison).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@galbus
galbus marked this pull request as ready for review July 19, 2026 11:02
@github-actions

Copy link
Copy Markdown

✅ WordPress Plugin Check Report

✅ Status: Passed

📊 Report

All checks passed! No errors or warnings found.


🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check

…ht in

Conflicts resolved by taking main's code (the poll-based embed replaced the
direct player construction) with this branch's why-only comment style. The
new lib/poll-content-status.js and the polling additions to the classic
metabox, play-audio hooks and their tests are trimmed the same way. Post-
merge, every PHP/JS file is code-identical to origin/main (php -w / espree
token comparison); phpcs and eslint pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@galbus
galbus requested a review from gouravkhunger July 19, 2026 11:29

@gouravkhunger gouravkhunger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @galbus! It'd be good to get rid of deprecated planning docs too. Anything that's required can be checked if needing any updates to content.

@galbus
galbus merged commit 6a3b2f6 into main Jul 19, 2026
10 checks passed
galbus added a commit that referenced this pull request Jul 19, 2026
main's comment trim (#589) touched the same voice-picker comments this
branch had already trimmed, so every conflict was doc-only text around
code only this branch has.

Resolved by keeping this branch's code throughout — main's side of those
hunks is the pre-PR implementation (single Language dropdown, no Native
filter, isResolvingVoices) and would have dropped the feature. For the
comment text, took whichever side was briefer and still accurate for
this branch's code, and corrected the few of main's that described the
old single-dropdown behaviour.
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.

2 participants