You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(well): only emit well-sm and well-lg for the size attribute - #86
[bs_well size="..."] built a well-<anything> class from whatever value the attribute carried. Bootstrap 3 only defines well-sm and well-lg, so any other value produced a class that matches nothing (and, pre-escaping, was a stray user-controlled token in the markup).
bs_well now whitelists sm and lg the same way bs_tooltip already whitelists placement: those two values add the size class, anything else (including an empty attribute) falls back to the plain well.
Design notes
Mirrors the existing in_array pattern in inc/bs_tooltip.php rather than introducing a new helper; the comparison is strict since shortcode attributes are always strings.
esc_attr() on the size is dropped because the value is now one of two literal constants, not user input.
Scope is deliberately limited to bs_well; other shortcodes with free-form class suffixes are untouched.
Verification
TDD: the new PHPUnit cases were added first and failed on well-xl being emitted, then the fix made them pass.
tests/phpunit/ShortcodeWellsTest.php: added sm, invalid (xl) and empty-size cases.
Full PHPUnit suite: 46 tests, 93 assertions, green.
Playwright e2e suite: 12 passed (the editor's Well dropdown inserts size="sm", still valid).
Bootstrap 3 defines only `well-sm` and `well-lg`, but `[bs_well]` built
`well-<anything>` from whatever value the attribute carried. Whitelist the
two valid sizes, the way `bs_tooltip` already does for `placement`, and
fall back to the plain `well` for any other or empty value.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.
Reviewing files that changed from the base of the PR and between 2fb027e and 4038b20.
Files selected for processing: 2
inc/bs_well.php
tests/phpunit/ShortcodeWellsTest.php
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
Walkthrough
bs_well now adds a size class only when the size is exactly sm or lg. Tests cover sm, invalid (xl), and empty size values, and verify that shortcode content remains in the output.
Changes
Well shortcode size validation
Layer / File(s)
Summary
Size class handling inc/bs_well.php, tests/phpunit/ShortcodeWellsTest.php
bs_well adds a size class only for sm or lg. Tests verify the sm class, the default class for invalid and empty sizes, and preservation of shortcode content.
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Title check
The title names the actual change: the bs_well shortcode now emits a size class only for sm or lg. It is specific, follows the fix() convention, and matches the raw summary and objectives. It does not…
Description check
The description explains the change. It says bs_well now accepts only sm and lg, that other values and empty attributes fall back to plain well, and that esc_attr() was dropped. It also covers the bs_…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the actual change: the bs_well shortcode now emits a size class only for sm or lg. It is specific, follows the fix() convention, and matches the raw summary and objectives. It does not mention the test additions, which is expected.
Full details: Description check
Explanation
The description explains the change. It says bs_well now accepts only sm and lg, that other values and empty attributes fall back to plain well, and that esc_attr() was dropped. It also covers the bs_tooltip pattern, the new PHPUnit cases, and the e2e run. This matches the changeset.
Full details: Docstring Coverage
Explanation
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 2 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Finishing Touches
Generate docstrings
Commit to this branch
Create a new PR
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Warning
Some tools did not complete. Review the errors below.
PHPStan (2.3.1)
PHPStan reported 1 non-file analysis error(s); analysis is incomplete
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
[bs_well size="..."]built awell-<anything>class from whatever value the attribute carried. Bootstrap 3 only defineswell-smandwell-lg, so any other value produced a class that matches nothing (and, pre-escaping, was a stray user-controlled token in the markup).bs_wellnow whitelistssmandlgthe same waybs_tooltipalready whitelistsplacement: those two values add the size class, anything else (including an empty attribute) falls back to the plainwell.Design notes
in_arraypattern ininc/bs_tooltip.phprather than introducing a new helper; the comparison is strict since shortcode attributes are always strings.esc_attr()on the size is dropped because the value is now one of two literal constants, not user input.bs_well; other shortcodes with free-form class suffixes are untouched.Verification
TDD: the new PHPUnit cases were added first and failed on
well-xlbeing emitted, then the fix made them pass.tests/phpunit/ShortcodeWellsTest.php: addedsm, invalid (xl) and empty-size cases.size="sm", still valid).🤖 Generated with Claude Code