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

Multi-line vs single-line method and class constructor declarations and invocations #58

Open
jkbradley opened this issue Jul 18, 2017 · 5 comments

Comments

@jkbradley
Copy link

Apache Spark (especially what I've seen of MLlib) and the current Scala style guide differ on one item: Should multiline method and class constructor invocations be written with 1 arg per line or multiple args per line?

Spark mostly uses multiple args per line (for invocation, not for declarations). The current Scala style guide says to put 1 arg per line: See "Methods with Numerous Arguments" here: http://docs.scala-lang.org/style/indentation.html

Can we add our standard to this doc?

E.g.:

  • For method and class definitions,
    • If they fit on 1 line, put everything on 1 line.
    • For multi-line definitions, put 1 argument per line.
  • For method and class constructor invocations,
    • If they fit on 1 line, put everything on 1 line.
    • For multi-line calls, put (multiple arguments per line) or (1 argument per line)?
@rxin
Copy link
Contributor

rxin commented Jul 18, 2017

How about if it requires more than two lines, one arg per line. If it fits in two lines, just fit them in two lines? That's what I personally do.

@HyukjinKwon
Copy link
Member

@rxin and @jkbradley, can I open a PR for describing it? Roughly like:

  • For method, class definitions, class constructor invocations,
    • If they fit within 2 line, put everything within 2 line.

      function("very long blabla........................................................")
      function(
        "very long blabla........................................................")
    • For multi-line, put multiple arguments per line?

      function(
        "very",
        "very long",
        "bla bla bla bla")
      

I think I can quickly do this if we are okay with ^.

@rxin
Copy link
Contributor

rxin commented Nov 14, 2017

sure - sounds good.

@jkbradley
Copy link
Author

Sounds good to me

@HyukjinKwon
Copy link
Member

@jkbradley, this is fixed in #64 :-)

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

No branches or pull requests

3 participants