Skip to content
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

New stop_paste_linter #999

Merged
merged 15 commits into from
Mar 28, 2022
Merged

New stop_paste_linter #999

merged 15 commits into from
Mar 28, 2022

Conversation

MichaelChirico
Copy link
Collaborator

Part of #962

This one could probably go for an improved name as well, but I am consistently stumped here.

R/stop_paste_linter.R Outdated Show resolved Hide resolved
R/stop_paste_linter.R Outdated Show resolved Hide resolved
@AshesITR
Copy link
Collaborator

Maybe call it redundant_paste_linter()? Could also add cat() to the list IINM.

@MichaelChirico
Copy link
Collaborator Author

cat() is slighlty different in that its default is ' ' not ''. but maybe right that using cat's own sep is always preferable to building the string with paste()/paste0().

However I have some gut feeling about why we didn't do that in the first place... can't place exactly why. I will run an updated linter that catches cat() against our internal codebase first to make sure nothing sticks out to me.

@AshesITR
Copy link
Collaborator

AshesITR commented Mar 28, 2022

cat() also auto-collapses using sep. Maybe that's why?

cat(">", letters, "<")
# > a b c d e f g h i j k l m n o p q r s t u v w x y z <

This means cat(paste(">", letters, "<")) is not equivalent to the above, it's cat(">", paste(letters, collapse = " "), "<").

@MichaelChirico
Copy link
Collaborator Author

Good point... so I guess it might be a bit muddled to include that in the same linter.

What about singal_construction_linter? Maybe too broad?

@AshesITR
Copy link
Collaborator

AshesITR commented Mar 28, 2022

Sounds too unfamiliar I think. What about message_linter() or message_construction_linter()?
It should be clear what a message is, plus message() is also linted.
Or condition_message_linter()? Since it lints the message construction of all signalling functions.

BTW: rlang::abort() and colleagues could be added further down the line.

@MichaelChirico
Copy link
Collaborator Author

Sounds too unfamiliar I think. What about message_linter() or message_construction_linter()?

I'd been specifically shying away from "message" because message() is just one part of what's included

Or condition_message_linter()? Since it lints the message construction of all signalling functions.

I think that's probably the way to go. "condition" as an adjective helps make clearer that it's not just message(). will do.

MichaelChirico and others added 6 commits March 28, 2022 16:18
# Conflicts:
#	DESCRIPTION
#	NAMESPACE
#	inst/lintr/linters.csv
#	man/best_practices_linters.Rd
#	man/consistency_linters.Rd
#	man/linters.Rd
Copy link
Collaborator

@AshesITR AshesITR left a comment

Choose a reason for hiding this comment

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

LGTM apart from the doc problem.

# Conflicts:
#	DESCRIPTION
#	NAMESPACE
#	inst/lintr/linters.csv
#	man/best_practices_linters.Rd
#	man/linters.Rd
@AshesITR
Copy link
Collaborator

Should we stop() or at least issue a warning() if tags are empty? The "No tags were given" message seems to be too quiet...

@MichaelChirico MichaelChirico merged commit 03448b0 into master Mar 28, 2022
@MichaelChirico MichaelChirico deleted the stop_paste branch March 28, 2022 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants