Skip to content

Fix attribute-in-quoted-value false positive#44

Merged
j9t merged 4 commits into
mainfrom
fix/attribute-in-quoted-value-false-positive
May 11, 2026
Merged

Fix attribute-in-quoted-value false positive#44
j9t merged 4 commits into
mainfrom
fix/attribute-in-quoted-value-false-positive

Conversation

@j9t

@j9t j9t commented May 11, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Bug Fixes
    • Fixed false positives where obsolete HTML attribute names (such as scrolling, background, border) were incorrectly flagged when appearing as text within quoted attribute values.

Review Change Stack

j9t added 3 commits May 11, 2026 10:25
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>
@coderabbitai

coderabbitai Bot commented May 11, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@j9t has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 46 minutes and 17 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: fda1f67e-dfa7-4dcf-8b43-f8ac9fe3f9e9

📥 Commits

Reviewing files that changed from the base of the PR and between ac3bac8 and a2d8fd8.

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

Walkthrough

This 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.

Changes

False Positive Fix for Quoted Attribute Values

Layer / File(s) Summary
Attribute Detection Regex
src/index.js
The attributeRegexes pattern is tightened to use whitespace-delimited matching within tags while accounting for quoted segments, preventing attribute-name-like strings inside quoted values from triggering matches.
Test Validation
bin/obsohtml.test.js
A new checkMarkup test case verifies that words like "scrolling", "background", and "border" embedded in quoted attribute values (e.g., content="Infinite scrolling") do not raise false-positive detections.
Release Documentation
package.json, CHANGELOG.md
Package version is bumped from 1.10.0 to 1.10.1, and the changelog documents the fix for false positives in quoted attribute values.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • j9t/obsohtml#39: Both PRs modify the src/index.js detection logic and attributeRegexes behavior to improve accuracy of obsolete-attribute matching.
  • j9t/obsohtml#9: Both PRs refine attribute detection regex/logic to reduce false matches in obsolete-attribute identification.
  • j9t/obsohtml#4: Both PRs update attribute-detection regular expressions to improve the precision of obsolete-attribute detection.
🚥 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 precisely describes the main change: fixing false positives where obsolete attribute names were incorrectly detected within quoted attribute values.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/attribute-in-quoted-value-false-positive

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.

@coderabbitai coderabbitai Bot 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.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 87a7ac8 and ac3bac8.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (4)
  • CHANGELOG.md
  • bin/obsohtml.test.js
  • package.json
  • src/index.js

Comment thread bin/obsohtml.test.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>

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

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.

@j9t j9t merged commit f47c267 into main May 11, 2026
12 checks passed
@j9t j9t deleted the fix/attribute-in-quoted-value-false-positive branch May 11, 2026 08:45
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