Fix attribute-in-quoted-value false positive#44
Conversation
Adjusted the regular expression to avoid false positives for obsolete attributes within quoted values. Added new test cases to validate the updated behavior and ensure robust handling of edge cases. (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>
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThis PR fixes false-positive detections in the obsohtml library by refining the attribute-detection regex to avoid matching obsolete attribute names when they appear as text inside quoted attribute values. The fix includes test validation, a version bump to 1.10.1, and changelog documentation. ChangesFalse Positive Fix for Quoted Attribute Values
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/obsohtml.test.js`:
- Around line 199-206: The test "Do not flag an obsolete attribute name
appearing inside a quoted attribute value" currently only covers double-quoted
attribute values; add at least one case with a single-quoted attribute value to
the cases array (e.g., a meta/img line where the relevant attribute value is
wrapped in single quotes) so the regex behavior for single quotes is
exercised—update the cases constant in the test to include that single-quoted
example.
🪄 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: 394ea5a1-0900-418c-881f-f067813f5394
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (4)
CHANGELOG.mdbin/obsohtml.test.jspackage.jsonsrc/index.js
Added a test case to validate consistent handling of single and double quotes in image alt attributes. This helps to ensure robustness in parsing across various quote styles. (This commit message was AI-generated.) Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes a false positive in ObsoHTML’s attribute detection by ensuring obsolete attribute names are only matched as actual attributes within a tag, not as plain text inside quoted attribute values.
Changes:
- Updated the attribute-matching regex to ignore occurrences inside quoted attribute values within a tag.
- Added a regression test covering quoted-value false positives for obsolete attribute names.
- Bumped package version to 1.10.1 and documented the fix in the changelog.
Reviewed changes
Copilot reviewed 3 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/index.js | Refines the obsolete-attribute regex to skip quoted attribute values when scanning tags. |
| bin/obsohtml.test.js | Adds a regression test ensuring quoted-value text doesn’t trigger obsolete-attribute flags. |
| package.json | Bumps version to 1.10.1. |
| package-lock.json | Updates lockfile version fields to 1.10.1. |
| CHANGELOG.md | Adds 1.10.1 entry describing the false-positive fix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary by CodeRabbit
scrolling,background,border) were incorrectly flagged when appearing as text within quoted attribute values.