Skip to content

feature request: styling function definition with multiple arguments to one argument per line #719

Closed
@IndrajeetPatil

Description

@IndrajeetPatil

The tidyverse style guide mentions:

image

Although it doesn't explicitly recommend that when the function definition looks like the following, there should be one argument per line to improve readability, but I am guessing that this is something implicitly being hinted at? Not sure.

styler::style_text(
'
foo <- function(posteriors, centrality = "median", dispersion = FALSE, ci = 0.89, ci_method = "hdi", test = c("p_direction", "rope"), rope_range = "default", rope_ci = 0.89, component = c("all", "conditional", "location"), parameters = NULL, ...) {}
'
)
#> 
#> foo <- function(posteriors, centrality = "median", dispersion = FALSE, ci = 0.89, ci_method = "hdi", test = c("p_direction", "rope"), rope_range = "default", rope_ci = 0.89, component = c("all", "conditional", "location"), parameters = NULL, ...) {}

Nevertheless, I was wondering if you think this (styling to one argument per line) is something that styler should be doing by default? Of course, it might not make sense to do this when there are only a few (3-4?) arguments present, but would have increasing utility the more arguments are present.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions