Skip to content

New stop_paste_linter - #999

Merged
MichaelChirico merged 15 commits into
masterfrom
stop_paste
Mar 28, 2022
Merged

MichaelChirico merged 15 commits into
masterfrom
stop_paste

Conversation

@MichaelChirico

Copy link
Copy Markdown
Collaborator

Part of #962

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

Comment thread R/stop_paste_linter.R Resolved
Comment thread R/stop_paste_linter.R Resolved
@AshesITR

Copy link
Copy Markdown
Collaborator

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

@MichaelChirico

Copy link
Copy Markdown
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

AshesITR commented Mar 28, 2022 •

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
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

AshesITR commented Mar 28, 2022 •

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
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
Comment thread man/condition_message_linter.Rd Resolved
Comment thread R/condition_message_linter.R Resolved

@AshesITR AshesITR left a comment

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.

LGTM apart from the doc problem.

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

Copy link
Copy Markdown
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