[SPARK-7940] Enforce whitespace checking for DO, TRY, CATCH, FINALLY, MATCH, LARROW, RARROW in style checker.

…

Author: Reynold Xin <rxin@databricks.com>

Closes #6491 from rxin/more-whitespace and squashes the following commits:

f6e63dc [Reynold Xin] [SPARK-7940] Enforce whitespace checking for DO, TRY, CATCH, FINALLY, MATCH, LARROW, RARROW in style checker.

(cherry picked from commit 94f62a4979)
Signed-off-by: Reynold Xin <rxin@databricks.com>
This commit is contained in:
Reynold Xin 2015-05-29 13:38:37 -07:00
parent e549874c33
commit f40605f064
9 changed files with 13 additions and 15 deletions

View file

@ -155,7 +155,7 @@ private[nio] class BlockMessage() {
override def toString: String = {
"BlockMessage [type = " + typ + ", id = " + id + ", level = " + level +
", data = " + (if (data != null) data.remaining.toString else "null") + "]"
", data = " + (if (data != null) data.remaining.toString else "null") + "]"
}
}

View file

@ -326,15 +326,14 @@ class SendingConnection(val address: InetSocketAddress, selector_ : Selector,
// MUST be called within the selector loop
def connect() {
try{
try {
channel.register(selector, SelectionKey.OP_CONNECT)
channel.connect(address)
logInfo("Initiating connection to [" + address + "]")
} catch {
case e: Exception => {
case e: Exception =>
logError("Error connecting to " + address, e)
callOnExceptionCallbacks(e)
}
}
}

View file

@ -635,12 +635,11 @@ private[nio] class ConnectionManager(
val message = securityMsgResp.toBufferMessage
if (message == null) throw new IOException("Error creating security message")
sendSecurityMessage(waitingConn.getRemoteConnectionManagerId(), message)
} catch {
case e: Exception => {
} catch {
case e: Exception =>
logError("Error handling sasl client authentication", e)
waitingConn.close()
throw new IOException("Error evaluating sasl response: ", e)
}
}
}
}

View file

@ -86,7 +86,7 @@ class PartitionerAwareUnionRDD[T: ClassTag](
}
val location = if (locations.isEmpty) {
None
} else {
} else {
// Find the location that maximum number of parent partitions prefer
Some(locations.groupBy(x => x).maxBy(_._2.length)._1)
}

View file

@ -83,7 +83,7 @@ class Node (
def predict(features: Vector) : Double = {
if (isLeaf) {
predict.predict
} else{
} else {
if (split.get.featureType == Continuous) {
if (features(split.get.feature) <= split.get.threshold) {
leftNode.get.predict(features)

View file

@ -119,7 +119,7 @@ object LogisticRegressionSuite {
}
// Preventing the overflow when we compute the probability
val maxMargin = margins.max
if (maxMargin > 0) for (i <-0 until nClasses) margins(i) -= maxMargin
if (maxMargin > 0) for (i <- 0 until nClasses) margins(i) -= maxMargin
// Computing the probabilities for each class from the margins.
val norm = {
@ -130,7 +130,7 @@ object LogisticRegressionSuite {
}
temp
}
for (i <-0 until nClasses) probs(i) /= norm
for (i <- 0 until nClasses) probs(i) /= norm
// Compute the cumulative probability so we can generate a random number and assign a label.
for (i <- 1 until nClasses) probs(i) += probs(i - 1)

View file

@ -144,12 +144,12 @@
<check level="error" class="org.scalastyle.scalariform.SpaceAfterCommentStartChecker" enabled="true"></check>
<check level="error" class="org.scalastyle.scalariform.EnsureSingleSpaceBeforeTokenChecker" enabled="true">
<parameters>
<parameter name="tokens">ARROW, EQUALS</parameter>
<parameter name="tokens">ARROW, EQUALS, ELSE, TRY, CATCH, FINALLY, LARROW, RARROW</parameter>
</parameters>
</check>
<check level="error" class="org.scalastyle.scalariform.EnsureSingleSpaceAfterTokenChecker" enabled="true">
<parameters>
<parameter name="tokens">ARROW, EQUALS, COMMA, COLON, IF, WHILE, FOR</parameter>
<parameter name="tokens">ARROW, EQUALS, COMMA, COLON, IF, ELSE, DO, WHILE, FOR, MATCH, TRY, CATCH, FINALLY, LARROW, RARROW</parameter>
</parameters>
</check>
<check level="error" class="org.scalastyle.scalariform.NotImplementedErrorUsage" enabled="true"></check>

View file

@ -203,7 +203,7 @@ object UTF8String {
def apply(s: String): UTF8String = {
if (s != null) {
new UTF8String().set(s)
} else{
} else {
null
}
}

View file

@ -262,7 +262,7 @@ private[sql] class JDBCRDD(
}
private def escapeSql(value: String): String =
if (value == null) null else StringUtils.replace(value, "'", "''")
if (value == null) null else StringUtils.replace(value, "'", "''")
/**
* Turns a single Filter into a String representing a SQL expression.