Skip to content

Commit 3f958a9

Browse files
author
Marcelo Vanzin
committed
[SPARK-21731][BUILD] Upgrade scalastyle to 0.9.
This version fixes a few issues in the import order checker; it provides better error messages, and detects more improper ordering (thus the need to change a lot of files in this patch). The main fix is that it correctly complains about the order of packages vs. classes. As part of the above, I moved some "SparkSession" import in ML examples inside the "$example on$" blocks; that didn't seem consistent across different source files to start with, and avoids having to add more on/off blocks around specific imports. The new scalastyle also seems to have a better header detector, so a few license headers had to be updated to match the expected indentation. Author: Marcelo Vanzin <[email protected]> Closes #18943 from vanzin/SPARK-21731.
1 parent cba826d commit 3f958a9

File tree

184 files changed

+766
-783
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

184 files changed

+766
-783
lines changed

core/src/main/scala/org/apache/spark/api/java/JavaDoubleRDD.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import java.lang.{Double => JDouble}
2222
import scala.language.implicitConversions
2323
import scala.reflect.ClassTag
2424

25-
import org.apache.spark.annotation.Since
2625
import org.apache.spark.Partitioner
26+
import org.apache.spark.annotation.Since
2727
import org.apache.spark.api.java.function.{Function => JFunction}
2828
import org.apache.spark.partial.{BoundedDouble, PartialResult}
2929
import org.apache.spark.rdd.RDD

core/src/main/scala/org/apache/spark/api/python/PythonWorkerFactory.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import java.net.{InetAddress, ServerSocket, Socket, SocketException}
2222
import java.nio.charset.StandardCharsets
2323
import java.util.Arrays
2424

25-
import scala.collection.mutable
2625
import scala.collection.JavaConverters._
26+
import scala.collection.mutable
2727

2828
import org.apache.spark._
2929
import org.apache.spark.internal.Logging

core/src/main/scala/org/apache/spark/api/r/JVMObjectTracker.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
package org.apache.spark.api.r
1919

20-
import java.util.concurrent.atomic.AtomicInteger
2120
import java.util.concurrent.ConcurrentHashMap
21+
import java.util.concurrent.atomic.AtomicInteger
2222

2323
/** JVM object ID wrapper */
2424
private[r] case class JVMObjectId(id: String) {

core/src/main/scala/org/apache/spark/api/r/RBackendHandler.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ import io.netty.channel.{ChannelHandlerContext, SimpleChannelInboundHandler}
2626
import io.netty.channel.ChannelHandler.Sharable
2727
import io.netty.handler.timeout.ReadTimeoutException
2828

29+
import org.apache.spark.SparkConf
2930
import org.apache.spark.api.r.SerDe._
3031
import org.apache.spark.internal.Logging
31-
import org.apache.spark.SparkConf
3232
import org.apache.spark.util.{ThreadUtils, Utils}
3333

3434
/**

core/src/main/scala/org/apache/spark/deploy/PythonRunner.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ package org.apache.spark.deploy
2020
import java.io.File
2121
import java.net.URI
2222

23-
import scala.collection.mutable.ArrayBuffer
2423
import scala.collection.JavaConverters._
24+
import scala.collection.mutable.ArrayBuffer
2525
import scala.util.Try
2626

2727
import org.apache.spark.{SparkConf, SparkUserAppException}

core/src/main/scala/org/apache/spark/deploy/SparkHadoopUtil.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import java.security.PrivilegedExceptionAction
2222
import java.text.DateFormat
2323
import java.util.{Arrays, Comparator, Date, Locale}
2424

25-
import scala.collection.immutable.Map
2625
import scala.collection.JavaConverters._
26+
import scala.collection.immutable.Map
2727
import scala.collection.mutable
2828
import scala.collection.mutable.HashMap
2929
import scala.util.control.NonFatal

core/src/main/scala/org/apache/spark/deploy/rest/RestSubmissionServer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Unless required by applicable law or agreed to in writing, software
1212
* distributed under the License is distributed on an "AS IS" BASIS,
1313
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
* See the License for the specific language governing permissions and
14+
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
1717

core/src/main/scala/org/apache/spark/deploy/rest/StandaloneRestServer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Unless required by applicable law or agreed to in writing, software
1212
* distributed under the License is distributed on an "AS IS" BASIS,
1313
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
* See the License for the specific language governing permissions and
14+
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
1717

core/src/main/scala/org/apache/spark/deploy/worker/WorkerArguments.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ import java.lang.management.ManagementFactory
2121

2222
import scala.annotation.tailrec
2323

24-
import org.apache.spark.util.{IntParam, MemoryParam, Utils}
2524
import org.apache.spark.SparkConf
25+
import org.apache.spark.util.{IntParam, MemoryParam, Utils}
2626

2727
/**
2828
* Command-line parser for the worker.

core/src/main/scala/org/apache/spark/input/PortableDataStream.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ import org.apache.hadoop.fs.Path
2727
import org.apache.hadoop.mapreduce.{InputSplit, JobContext, RecordReader, TaskAttemptContext}
2828
import org.apache.hadoop.mapreduce.lib.input.{CombineFileInputFormat, CombineFileRecordReader, CombineFileSplit}
2929

30-
import org.apache.spark.internal.config
3130
import org.apache.spark.SparkContext
3231
import org.apache.spark.annotation.Since
32+
import org.apache.spark.internal.config
3333

3434
/**
3535
* A general format for reading whole files in as streams, byte arrays,

0 commit comments

Comments
 (0)