Skip to content

Conversation

@ANAMASGARD
Copy link
Contributor

@ANAMASGARD ANAMASGARD commented Oct 7, 2025

Fixes #232

I First reproduced the test locally which you gave in hte issue :-

nearest neighbors :--- blank browser page, no error. "Before"

Screenshot From 2025-10-07 16-25-18

Then I added R-side validation function checkSelectorNames() that:

  • Checks for 22 CSS special characters during compilation
  • Provides clear error messages identifying problematic selectors
  • Prevents blank browser pages by catching issues early

Changes made in these files :-

  • R/z_animintHelpers.R: New checkSelectorNames() validation function
  • R/z_animint.R: Call validation after selectors are populated
  • tests/testthat/test-compiler-invalid-selector-characters.R: 9 comprehensive tests
  • NEWS.md: Documentation of new feature.

After fix: "# nearest neighbors" → clear R error, suggests solution
Screenshot From 2025-10-07 22-00-55

I also ran Rscript in terminal for verification (below is the screenshot ):-
Rscript-for-verification-of-(#)

Commit Message Reference

The commit message mentions (#232) which links this PR to the issue for automatic tracking.

@ANAMASGARD ANAMASGARD force-pushed the fix/invalid-selector-character branch 2 times, most recently from 013965b to 32e15c5 Compare October 7, 2025 17:08
- Update NEWS.md to reference PR#246 instead of Issue animint#232
- Refactor checkSelectorNames() to use sprintf instead of paste0
- Remove unnecessary if(length==0) check and explicit return(NULL)
- Remove all empty lines from test_that blocks per style guidelines
@ANAMASGARD ANAMASGARD force-pushed the fix/invalid-selector-character branch from 44a793b to 258284c Compare October 11, 2025 07:23
…edback

Changed error message construction in checkSelectorNames() to use
one long literal string with \n newlines instead of sprintf with
multiple %s placeholders, following best practices from CRAN's
potools vignette.
@ANAMASGARD
Copy link
Contributor Author

✅ Uses one long literal string with \n newlines
✅ Follows CRAN best practices for translatable messages
a53f143
SIr can you now please review and tell me if anymore changes are needed .
THANK YOU !

@tdhock
Copy link
Collaborator

tdhock commented Oct 16, 2025

hi please read my comments and push some fixes.

also can you please avoid using AI code generation? (Github copilot etc)
https://github.com/animint/animint2/blob/master/CONTRIBUTING.md#avoid-ai-code-generation
It makes lots of irrelevant code that is difficult to review.

@ANAMASGARD
Copy link
Contributor Author

Ok Sir, I just wanted to ask as I am the developer member of this org so should I directly push commits on the master branch on this repo.
Like can you please guide how can we avoid getting these Test Suite fails.
Also as I have created multiple branches for each issues so should I merge them to the master.

@tdhock
Copy link
Collaborator

tdhock commented Oct 16, 2025

please avoid pushing to master branch.
please create other branches in this repo instead, and then PR with master.

@tdhock
Copy link
Collaborator

tdhock commented Oct 16, 2025

no please do not merge your branch with master unless I approve. please read https://github.com/animint/animint2/blob/master/CONTRIBUTING.md#prs-from-forks-versus-branches-in-this-repo

@ANAMASGARD
Copy link
Contributor Author

Sir I wanted to ask can you please review this PR and tell what changes I should be making so that test pass .
Also at the time of making this PR I was not member of animint2 so i made the branch from the forked repo ,
should i make a new branch from the master of animint2 and raise a new PR , what do you suggest Sir ??

@tdhock
Copy link
Collaborator

tdhock commented Oct 22, 2025

I'm waiting for you to address this review comment #246 (comment)

Did you see that?

In general to emphasize the review comments that are still relevant, you should click on "Resolve conversation" for the ones that are already addressed.

Address review comment to simplify nested sapply calls and fix test typo.
@ANAMASGARD ANAMASGARD force-pushed the fix/invalid-selector-character branch from b7f425b to 4277d24 Compare November 9, 2025 15:03
@ANAMASGARD
Copy link
Contributor Author

ANAMASGARD commented Nov 9, 2025

Sir @tdhock,

  • I've addressed all your review feedback

  • Sir I thing it is failing because of the GitHub API tests fail , can you please review it and give your feedback because I have run test locally and all passed .

  • Also can you please tell are these test failing because I have made this branch from the forked repo's master
    branch instead the master of this project directly ?

  • Should I close and make a new branch from the animint2 master branch then raise a new PR will it help in making the test case pass ??

Thank you .

@ANAMASGARD ANAMASGARD requested a review from tdhock November 9, 2025 15:39
@tdhock
Copy link
Collaborator

tdhock commented Nov 11, 2025

please click "Resolve conversation" on old comments, after pushing fixes.

@ANAMASGARD ANAMASGARD requested a review from tdhock November 12, 2025 15:20
@ANAMASGARD ANAMASGARD requested a review from tdhock November 14, 2025 16:58
@ANAMASGARD ANAMASGARD requested a review from tdhock November 17, 2025 05:27
## Most problematic: # (hash/id selector), . (class selector), : (pseudo-class)
## We check for these common problematic characters
invalid.chars <- c("#", "!", "@", "$", "%", "^", "&", "*", "=", "|", "\\", "/", "'", "\"", "`", "?", "<", ">", "(", ")", "[", "]")

Copy link
Collaborator

Choose a reason for hiding this comment

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

please undo addition of empty lines

Comment on lines 624 to 633
has.invalid <- vapply(selector.names, function(name) {
any(vapply(invalid.chars, grepl, logical(1), x = name, fixed = TRUE))
}, logical(1))

if(any(has.invalid)){
invalid.names <- selector.names[has.invalid]
## Find which character(s) are problematic for each name
problematic <- sapply(invalid.names, function(name) {
found.chars <- invalid.chars[sapply(invalid.chars, grepl, name, fixed = TRUE)]
paste0("'", found.chars, "'", collapse = ", ")
Copy link
Collaborator

Choose a reason for hiding this comment

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

please remove sapply, which is not necessary
just use grep or grepl

Copy link
Collaborator

Choose a reason for hiding this comment

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

and remove vapply

Copy link
Collaborator

Choose a reason for hiding this comment

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

and remove logical(1) which is confusing. Where did you learn that? why not just use FALSE instead?

> logical(1)
[1] FALSE

@ANAMASGARD ANAMASGARD force-pushed the fix/invalid-selector-character branch from 05b8283 to 32adade Compare November 26, 2025 07:17
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.

blank plots when selector name contains #

2 participants