There are a few bits of the Scala style that are underspecified by
both the Scala
style guide <http://docs.scala-lang.org/style/> and our own supplemental
notes<https://cwiki.apache.org/confluence/display/SPARK/Spark+Code+Style+Guide>.
Often, this leads to inconsistent formatting within the codebase, so I'd
like to propose some general guidelines which we can add to the wiki and
use in the future:

1) Line-wrapped method return type is indented with two spaces:
def longMethodName(... long param list ...)
  : Long = {
  2
}

*Justification: *I think this is the most commonly used style in Spark
today. It's also similar to the "extends" style used in classes, with the
same justification: it is visually distinguished from the 4-indented
parameter list.

2) URLs and code examples in comments should not be line-wrapped.
Here<https://github.com/apache/incubator-spark/pull/557/files#diff-c338f10f3567d4c1d7fec4bf9e2677e1L29>is
an example of the latter.

*Justification*: Line-wrapping can cause confusion when trying to
copy-paste a URL or command. Can additionally cause IDE issues or,
avoidably, Javadoc issues.

Any thoughts on these, or additional style issues not explicitly covered in
either the Scala style guide or Spark wiki?

Reply via email to