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

Formatting of multi-line function/event calls #10

Open
grigorescu opened this issue Mar 25, 2022 · 2 comments
Open

Formatting of multi-line function/event calls #10

grigorescu opened this issue Mar 25, 2022 · 2 comments
Labels
style tweak A suggestion to style things differently

Comments

@grigorescu
Copy link

Currently, we have a script in base with the following:

info$store = Broker::create_clone(info$name,
                                  info$clone_resync_interval,
                                  info$clone_stale_interval,
                                  info$clone_mutation_buffer_interval);

The formatter tries to re-format it to:

info$store = Broker::create_clone(info$name, info$clone_resync_interval,
    info$clone_stale_interval, info$clone_mutation_buffer_interval);

I find the first version much more readable. Any other thoughts?

@JustinAzoff
Copy link

I personally prefer

info$store = Broker::create_clone(
    info$name,
    info$clone_resync_interval,
    info$clone_stale_interval,
    info$clone_mutation_buffer_interval,
);

but I might be in the minority here :-)

@grigorescu
Copy link
Author

I don't mind that style, @JustinAzoff, but what you typed generates a parsing error, due to the last comma. (Whether or not it should be is a separate discussion).

Given that, I think I prefer the last line having the close parens and semicolon. It seems like it'd be an easy trap to fall into of re-arranging parameters and missing the fact that the last one must have no comma. The parens makes it a bit more explicit.

@ckreibich ckreibich added the style tweak A suggestion to style things differently label May 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
style tweak A suggestion to style things differently
Projects
None yet
Development

No branches or pull requests

3 participants