Skip to content

fix symbols style - #698

Merged
AshesITR merged 2 commits into
masterfrom
fix/object_name-symbols
Dec 10, 2020
Merged

AshesITR merged 2 commits into
masterfrom
fix/object_name-symbols

Conversation

@AshesITR

@AshesITR AshesITR commented Dec 9, 2020

Copy link
Copy Markdown
Collaborator

fixes #495

the major issue was that as.character() doesn't unescape XML entities. xml2::xml_text() should have been used instead.

fixes #495

the major issue was that `as.character()` doesn't unescape XML entities. `xml2::xml_text()` should have been used instead.
Comment thread R/object_name_linters.R Resolved
Comment thread R/object_name_linters.R

style_regexes <- list(
"symbols" = rex(start, maybe("."), zero_or_more(none_of(alnum)), end),
"symbols" = rex(start, zero_or_more(none_of(alnum)), end),

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The empty name can occur here because symbols like <- are stripped before passing on to the regex.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this feels somewhat hacky... but OK for now.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The reason is the other styles should allow e.g. snake_case<- as a function name

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

As long as applying those rules in the same order always works, we're OK, I'm just not 100% sure of that.

@AshesITR
AshesITR merged commit 180e1a1 into master Dec 10, 2020
@AshesITR
AshesITR deleted the fix/object_name-symbols branch December 10, 2020 07:05
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.

False-positive object_name_linter for %<-%

2 participants