scala-style-guide icon indicating copy to clipboard operation
scala-style-guide copied to clipboard

Synchronized definitions which exceed 100 columns

Open mgyucht opened this issue 10 years ago • 2 comments

Consider the first line of an implementation method like this:

                                                                                                    | <- 100 columns
  override def moveObject(audit: AuditInfo, source: String, destination: String): Unit = synchronized {

Is the appropriate style to change this to something like

                                                                                                    | <- 100 columns
  override def moveObject(audit: AuditInfo, source: String, destination: String): Unit = {
    synchronized {

or

                                                                                                    | <- 100 columns
  override def moveObject(audit: AuditInfo, source: String, destination: String): Unit =
    synchronized {

If we remove the outermost block, the inner indentation level will be one stop closer to the left margin.

mgyucht avatar Nov 13 '15 01:11 mgyucht

I think either could work. No strong opinion here.

rxin avatar Nov 13 '15 17:11 rxin

I consider the first slightly preferable for the same reason why we prefer braces around defs which are not one-liners.

aarondav avatar Nov 13 '15 18:11 aarondav