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 /scalastyle-config.xml | |
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 'scalastyle-config.xml')
-rw-r--r-- | scalastyle-config.xml | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/scalastyle-config.xml b/scalastyle-config.xml index 64619d2108..37d2ecf48e 100644 --- a/scalastyle-config.xml +++ b/scalastyle-config.xml @@ -215,6 +215,14 @@ This file is divided into 3 sections: </parameters> </check> + <!-- SPARK-3854: Single Space between ')' and '{' --> + <check customId="SingleSpaceBetweenRParenAndLCurlyBrace" level="error" class="org.scalastyle.file.RegexChecker" enabled="true"> + <parameters><parameter name="regex">\)\{</parameter></parameters> + <customMessage><![CDATA[ + Single Space between ')' and `{`. + ]]></customMessage> + </check> + <!-- ================================================================================ --> <!-- rules we'd like to enforce, but haven't cleaned up the codebase yet --> <!-- ================================================================================ --> |