Skip to content

Ignore CSS pseudo-selector :: patterns in dependency extraction used by att_amend_desc#133

Closed
VincentGuyader with Copilot wants to merge 6 commits into
mainfrom
copilot/fix-false-positives-css-rules
Closed

Ignore CSS pseudo-selector :: patterns in dependency extraction used by att_amend_desc#133
VincentGuyader with Copilot wants to merge 6 commits into
mainfrom
copilot/fix-false-positives-css-rules

Conversation

Copilot AI commented Apr 19, 2026

Copy link
Copy Markdown

att_amend_desc() was producing false dependency positives when scanning code that contains CSS selectors like label::after. The parser treated :: inside string literals as namespace calls and extracted bogus package names.

  • Scope

    • Updated dependency extraction in att_from_rscript() to ignore pkg:: detection inside quoted string literals.
    • Kept existing detection for real namespace calls and library()/require()/requireNamespace() usage unchanged.
  • Behavioral change

    • CSS/content strings are no longer interpreted as package dependencies.
    • Legitimate calls such as glue::glue() remain detected.
  • Coverage added

    • Added a focused unit test in tests/testthat/test-rscript.R to assert:
      • glue::glue() is detected.
      • label::after inside a CSS string is not detected.
x <- ".pretty .state label::after { color: red; }"
glue::glue("ok")
# detected deps => "glue" (not "label")

Copilot AI and others added 4 commits April 19, 2026 15:50
Agent-Logs-Url: https://github.com/ThinkR-open/attachment/sessions/319ceb68-c3d2-4c15-95b8-0bd45ca20959

Co-authored-by: VincentGuyader <10470699+VincentGuyader@users.noreply.github.com>
Agent-Logs-Url: https://github.com/ThinkR-open/attachment/sessions/319ceb68-c3d2-4c15-95b8-0bd45ca20959

Co-authored-by: VincentGuyader <10470699+VincentGuyader@users.noreply.github.com>
Agent-Logs-Url: https://github.com/ThinkR-open/attachment/sessions/319ceb68-c3d2-4c15-95b8-0bd45ca20959

Co-authored-by: VincentGuyader <10470699+VincentGuyader@users.noreply.github.com>
Agent-Logs-Url: https://github.com/ThinkR-open/attachment/sessions/319ceb68-c3d2-4c15-95b8-0bd45ca20959

Co-authored-by: VincentGuyader <10470699+VincentGuyader@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix false positives detected from CSS rules in att_amend_desc Ignore CSS pseudo-selector :: patterns in dependency extraction used by att_amend_desc Apr 19, 2026
Copilot AI requested a review from VincentGuyader April 19, 2026 15:53
@VincentGuyader

Copy link
Copy Markdown
Member

@copilot fix this

Agent-Logs-Url: https://github.com/ThinkR-open/attachment/sessions/16289198-c761-4f4f-b380-39925762c303

Co-authored-by: VincentGuyader <10470699+VincentGuyader@users.noreply.github.com>

Copilot AI commented Apr 19, 2026

Copy link
Copy Markdown
Author

@copilot fix this

Done in 24d501f: I added a follow-up fix so att_from_rscripts() now only parses .R/.r files, which prevents CSS files like global.css (label::after) from being treated as dependencies. I also added a unit test covering this CSS-file case.

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.

att_amend_desc seems to detect dependencies from css rules ?

2 participants