Skip to content

Drop non-syntactic names from list in object_overwrite_linter() #2342

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from

Conversation

MichaelChirico
Copy link
Collaborator

Related to #2337

Such names (e.g. base::body<-) need special handling anyway that's not yet covered.

We could toggle whether to include such names, but I think we can leave that for if it's actually requested.

About 7% of exports from default packages fit this filter, so there should be some improvement, though I don't expect anything dramatic.

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (9565050) 99.40% compared to head (5018374) 99.40%.

❗ Current head 5018374 differs from pull request most recent head 30dd346. Consider uploading reports for the commit 30dd346 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2342   +/-   ##
=======================================
  Coverage   99.40%   99.40%           
=======================================
  Files         123      123           
  Lines        5584     5586    +2     
=======================================
+ Hits         5551     5553    +2     
  Misses         33       33           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@AshesITR
Copy link
Collaborator

This will be obsolete with #2344 I think, since I use get_r_string() there so overwrites of non-syntactic names should also be caught.

This reminds me that could use some tests.

@MichaelChirico
Copy link
Collaborator Author

This will be obsolete with #2344 I think, since I use get_r_string() there so overwrites of non-syntactic names should also be caught.

Not really -- note that object_name_linter() (IINM) uses the symbols regex for this:

parse(text = "`+` <- 2") |>
  xmlparsedata::xml_parse_data() |>
  xml2::read_xml() |>
  xml2::xml_find_all("//SYMBOL") |>
  get_r_string()
# [1] "`+`"

"+" %in% getNamespaceExports("base")
# [1] TRUE

I intentionally left out tests because I'd rather leave this as an implementation detail. If you think it's still worth catching overwrites like this, please file an issue & I'll close this PR.

@AshesITR
Copy link
Collaborator

Filed #2346

@AshesITR
Copy link
Collaborator

#2347 makes this obsolete for good, now. Closing.

@AshesITR AshesITR closed this Nov 23, 2023
@MichaelChirico MichaelChirico deleted the oo-names branch December 6, 2023 05:16
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.

3 participants