You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Don't add braces to function bodies specifically for S4 generics #1141
This is a bit more complex with current code since the rule is implemented to check if there is a function token and If yes, add the braces, without knowing about the fact that we are inside setGeneric. Can you identify we are inside setGeneric if standardGeneric is in the function body or is that not true? If it is mostly true, we could avoid adding the curly braces based on a condition where stadnardGeneric() is called inside the function. That would still add braces to a situation like this:
Activity
lorenzwalthert commentedon Nov 29, 2023
This is a bit more complex with current code since the rule is implemented to check if there is a function token and If yes, add the braces, without knowing about the fact that we are inside
setGeneric. Can you identify we are insidesetGenericifstandardGenericis in the function body or is that not true? If it is mostly true, we could avoid adding the curly braces based on a condition wherestadnardGeneric()is called inside the function. That would still add braces to a situation like this:MichaelChirico commentedon Feb 24, 2025
I don't see any CRAN packages using
standardGeneric()withoutsetGeneric()(at least,setGeneric()is in the same file):https://github.com/search?q=org%3Acran+lang%3AR+%2FstandardGeneric%5B%28%5D%2F+-%22setGeneric%22&type=code
I don't think there's anything stopping authors from doing:
It seems safe enough to me to go forward with the rule you proposed.
MichaelChirico commentedon Jun 5, 2026
I filed https://bugs.r-project.org/show_bug.cgi?id=19083