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

Improve consistency of naming internal functions #6072

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

teunbrand
Copy link
Collaborator

@teunbrand teunbrand commented Sep 3, 2024

This PR aims to fix #6024.

Briefly, it enforces some consistency on the various check_*() and validate_*() functions in ggplot2's unexported functions.

Check functions:

  • Check input verbatim
  • Their purpose is to throw conditions when input is unexpected
  • Return nothing (that is, invisible(NULL))

Validator functions:

  • Can take different variants of input
  • Their purpose is to converge output from input
  • Return a single type of output

In addition, a smaller category are functions that take possibly deprecated values and restore it to valid values. I've named these update_*() functions here, but that might be confusing and perhaps we could choose a better name.

@thomasp85
Copy link
Member

An alternative name to update_*() would be fix_*() since it implies something is wrong and that this function will do something about it and return a usable version?

Merge branch 'main' into internal_naming

# Conflicts:
#	R/geom-crossbar.R
#	R/geom-errorbarh.R
#	R/scale-colour.R
#	R/scale-hue.R
#	R/utilities-checks.R
#	tests/testthat/_snaps/facet-.md
#	tests/testthat/test-ggsave.R
@teunbrand
Copy link
Collaborator Author

I like it, good call

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.

Naming of internal helper functions
2 participants