Skip to content

Ensure ggproto methods start with { #6460

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

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

Conversation

yjunechoe
Copy link
Contributor

As discussed in #6459, this PR changes instances of function() ... into function() { ... } for ggproto methods.

There was one not-so-trivial case of ScaleDiscrete$transform:

ggplot2/R/scale-.R

Lines 981 to 983 in 86b32ce

transform = identity,

Because base::identity() is a one-liner without {, this fails the test:

identity
#> function (x) 
#> x
#> <bytecode: 0x000001b6a4393740>
#> <environment: namespace:base>

In this PR, ScaleDiscrete$transform is now the spelled-out version:

  transform = function(self, x) {
    x
  },

@teunbrand teunbrand linked an issue May 15, 2025 that may be closed by this pull request
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.

Chore: standardize one-liner ggproto methods to use {
1 participant