diff options
author | Dongjoon Hyun <dongjoon@apache.org> | 2016-03-10 15:57:22 -0800 |
---|---|---|
committer | Andrew Or <andrew@databricks.com> | 2016-03-10 15:57:22 -0800 |
commit | 91fed8e9c57764eca9463d129ecd68196db7f566 (patch) | |
tree | b06c678dc15258af92116019760e6b9c98d81c2d /streaming/src/main | |
parent | 81d48532d954a8aea28d7e1fb3aa32a78c708b63 (diff) | |
download | spark-91fed8e9c57764eca9463d129ecd68196db7f566.tar.gz spark-91fed8e9c57764eca9463d129ecd68196db7f566.tar.bz2 spark-91fed8e9c57764eca9463d129ecd68196db7f566.zip |
[SPARK-3854][BUILD] Scala style: require spaces before `{`.
## What changes were proposed in this pull request?
Since the opening curly brace, '{', has many usages as discussed in [SPARK-3854](https://issues.apache.org/jira/browse/SPARK-3854), this PR adds a ScalaStyle rule to prevent '){' pattern for the following majority pattern and fixes the code accordingly. If we enforce this in ScalaStyle from now, it will improve the Scala code quality and reduce review time.
```
// Correct:
if (true) {
println("Wow!")
}
// Incorrect:
if (true){
println("Wow!")
}
```
IntelliJ also shows new warnings based on this.
## How was this patch tested?
Pass the Jenkins ScalaStyle test.
Author: Dongjoon Hyun <dongjoon@apache.org>
Closes #11637 from dongjoon-hyun/SPARK-3854.
Diffstat (limited to 'streaming/src/main')
-rw-r--r-- | streaming/src/main/scala/org/apache/spark/streaming/Checkpoint.scala | 2 | ||||
-rw-r--r-- | streaming/src/main/scala/org/apache/spark/streaming/ui/StreamingPage.scala | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/streaming/src/main/scala/org/apache/spark/streaming/Checkpoint.scala b/streaming/src/main/scala/org/apache/spark/streaming/Checkpoint.scala index 298cdc05ac..11a4c7dfd0 100644 --- a/streaming/src/main/scala/org/apache/spark/streaming/Checkpoint.scala +++ b/streaming/src/main/scala/org/apache/spark/streaming/Checkpoint.scala @@ -230,7 +230,7 @@ class CheckpointWriter( // If the checkpoint file exists, back it up // If the backup exists as well, just delete it, otherwise rename will fail if (fs.exists(checkpointFile)) { - if (fs.exists(backupFile)){ + if (fs.exists(backupFile)) { fs.delete(backupFile, true) // just in case it exists } if (!fs.rename(checkpointFile, backupFile)) { diff --git a/streaming/src/main/scala/org/apache/spark/streaming/ui/StreamingPage.scala b/streaming/src/main/scala/org/apache/spark/streaming/ui/StreamingPage.scala index eb1e5b0fdc..b1bcd06803 100644 --- a/streaming/src/main/scala/org/apache/spark/streaming/ui/StreamingPage.scala +++ b/streaming/src/main/scala/org/apache/spark/streaming/ui/StreamingPage.scala @@ -558,7 +558,7 @@ private[ui] class JsCollector { def toHtml: Seq[Node] = { val js = s""" - |$$(document).ready(function(){ + |$$(document).ready(function() { | ${preparedStatements.mkString("\n")} | ${statements.mkString("\n")} |});""".stripMargin |