diff --git a/jvm-packages/scalastyle-config.xml b/jvm-packages/scalastyle-config.xml
index 0f74a17fb..abac10e2c 100644
--- a/jvm-packages/scalastyle-config.xml
+++ b/jvm-packages/scalastyle-config.xml
@@ -82,19 +82,27 @@ This file is divided into 3 sections:
-
+
+
+
-
+
+
+
-
+
+
+
-
+
+
+
@@ -121,14 +129,16 @@ This file is divided into 3 sections:
-
- ARROW, EQUALS, ELSE, TRY, CATCH, FINALLY, LARROW, RARROW
-
+
+ ARROW, EQUALS, ELSE, TRY, CATCH, FINALLY, LARROW, RARROW
+
- ARROW, EQUALS, COMMA, COLON, IF, ELSE, DO, WHILE, FOR, MATCH, TRY, CATCH, FINALLY, LARROW, RARROW
+ ARROW, EQUALS, COMMA, COLON, IF, ELSE, DO, WHILE, FOR, MATCH, TRY, CATCH, FINALLY,
+ LARROW, RARROW
+
@@ -136,14 +146,18 @@ This file is divided into 3 sections:
- @VisibleForTesting
+
+ @VisibleForTesting
+
- Runtime\.getRuntime\.addShutdownHook
+
+ Runtime\.getRuntime\.addShutdownHook
+
- mutable\.SynchronizedBuffer
+
+ mutable\.SynchronizedBuffer
+
- Class\.forName
+
+ Class\.forName
+
- JavaConversions
+
+ JavaConversions
+
Instead of importing implicits in scala.collection.JavaConversions._, import
- scala.collection.JavaConverters._ and use .asScala / .asJava methods
+ scala.collection.JavaConverters._ and use .asScala / .asJava methods
+
- java,scala,3rdParty,spark
+ java,scala,3rdParty,dmlc
javax?\..*
scala\..*
- (?!ml\.dmlc\.xgboost4j\.).*
+ (?!ml\.dmlc\.xgboost4j).*
ml.dmlc.xgboost4j.*
@@ -213,7 +234,7 @@ This file is divided into 3 sections:
-
+
@@ -225,7 +246,9 @@ This file is divided into 3 sections:
-
+
+
+
@@ -245,33 +268,81 @@ This file is divided into 3 sections:
- 800>
+
+ 800>
+
- 30
+
+ 30
+
- 10
+
+ 10
+
- 50
+
+ 50
+
-
+
+
+
- -1,0,1,2,3
+
+ -1,0,1,2,3
+
+
+
+
+
+
+
+
+ procedure syntax is deprecated in Scala 2.13: add return type `: Unit` and `=`
+
+
+
+ ArrayBuilder.make\[(.+)\]\(\)
+ false
+
+ ArrayBuilder.make does not accept parens anymore in Scala 2.13
+
+
+
+
+ (: |\[)(Indexed)?Seq\[[A-Za-z0-9_]+\]
+ false
+
+
+
diff --git a/jvm-packages/xgboost4j-spark-gpu/src/main/scala/ml/dmlc/xgboost4j/scala/QuantileDMatrix.scala b/jvm-packages/xgboost4j-spark-gpu/src/main/scala/ml/dmlc/xgboost4j/scala/QuantileDMatrix.scala
index 4f0c48fd0..a9fac0245 100644
--- a/jvm-packages/xgboost4j-spark-gpu/src/main/scala/ml/dmlc/xgboost4j/scala/QuantileDMatrix.scala
+++ b/jvm-packages/xgboost4j-spark-gpu/src/main/scala/ml/dmlc/xgboost4j/scala/QuantileDMatrix.scala
@@ -16,10 +16,10 @@
package ml.dmlc.xgboost4j.scala
-import ml.dmlc.xgboost4j.java.{Column, ColumnBatch, XGBoostError, QuantileDMatrix => JQuantileDMatrix}
-
import scala.collection.JavaConverters._
+import ml.dmlc.xgboost4j.java.{Column, ColumnBatch, QuantileDMatrix => JQuantileDMatrix, XGBoostError}
+
class QuantileDMatrix private[scala](
private[scala] override val jDMatrix: JQuantileDMatrix) extends DMatrix(jDMatrix) {
diff --git a/jvm-packages/xgboost4j-spark-gpu/src/test/resources/log4j.properties b/jvm-packages/xgboost4j-spark-gpu/src/test/resources/log4j.properties
new file mode 100644
index 000000000..d1e674a86
--- /dev/null
+++ b/jvm-packages/xgboost4j-spark-gpu/src/test/resources/log4j.properties
@@ -0,0 +1 @@
+log4j.logger.org.apache.spark=INFO
diff --git a/jvm-packages/xgboost4j-spark-gpu/src/test/scala/ml/dmlc/xgboost4j/scala/spark/GpuTestSuite.scala b/jvm-packages/xgboost4j-spark-gpu/src/test/scala/ml/dmlc/xgboost4j/scala/spark/GpuTestSuite.scala
index 60e705e98..1bda8f2b1 100644
--- a/jvm-packages/xgboost4j-spark-gpu/src/test/scala/ml/dmlc/xgboost4j/scala/spark/GpuTestSuite.scala
+++ b/jvm-packages/xgboost4j-spark-gpu/src/test/scala/ml/dmlc/xgboost4j/scala/spark/GpuTestSuite.scala
@@ -17,13 +17,12 @@
package ml.dmlc.xgboost4j.scala.rapids.spark
import java.nio.file.{Files, Path}
-import java.sql.{Date, Timestamp}
import java.util.{Locale, TimeZone}
import org.apache.spark.{GpuTestUtils, SparkConf}
import org.apache.spark.internal.Logging
import org.apache.spark.network.util.JavaUtils
-import org.apache.spark.sql.{Row, SparkSession}
+import org.apache.spark.sql.SparkSession
import org.scalatest.BeforeAndAfterAll
import org.scalatest.funsuite.AnyFunSuite
diff --git a/jvm-packages/xgboost4j-spark-gpu/src/test/scala/ml/dmlc/xgboost4j/scala/spark/GpuXGBoostPluginSuite.scala b/jvm-packages/xgboost4j-spark-gpu/src/test/scala/ml/dmlc/xgboost4j/scala/spark/GpuXGBoostPluginSuite.scala
index c84a8b51a..6559d90c7 100644
--- a/jvm-packages/xgboost4j-spark-gpu/src/test/scala/ml/dmlc/xgboost4j/scala/spark/GpuXGBoostPluginSuite.scala
+++ b/jvm-packages/xgboost4j-spark-gpu/src/test/scala/ml/dmlc/xgboost4j/scala/spark/GpuXGBoostPluginSuite.scala
@@ -16,18 +16,20 @@
package ml.dmlc.xgboost4j.scala.spark
+import java.io.File
+
+import scala.collection.mutable.ArrayBuffer
+
import ai.rapids.cudf.{OrderByArg, Table}
+import org.apache.spark.SparkConf
+import org.apache.spark.ml.linalg.DenseVector
+import org.apache.spark.sql.{Dataset, Row, SparkSession}
+
import ml.dmlc.xgboost4j.java.CudfColumnBatch
import ml.dmlc.xgboost4j.scala.{DMatrix, QuantileDMatrix, XGBoost => ScalaXGBoost}
import ml.dmlc.xgboost4j.scala.rapids.spark.GpuTestSuite
import ml.dmlc.xgboost4j.scala.rapids.spark.SparkSessionHolder.withSparkSession
import ml.dmlc.xgboost4j.scala.spark.Utils.withResource
-import org.apache.spark.ml.linalg.DenseVector
-import org.apache.spark.sql.{Dataset, Row, SparkSession}
-import org.apache.spark.SparkConf
-
-import java.io.File
-import scala.collection.mutable.ArrayBuffer
class GpuXGBoostPluginSuite extends GpuTestSuite {
diff --git a/jvm-packages/xgboost4j-spark/src/main/scala/ml/dmlc/xgboost4j/scala/spark/XGBoostRanker.scala b/jvm-packages/xgboost4j-spark/src/main/scala/ml/dmlc/xgboost4j/scala/spark/XGBoostRanker.scala
index 6e020560e..14d13e34f 100644
--- a/jvm-packages/xgboost4j-spark/src/main/scala/ml/dmlc/xgboost4j/scala/spark/XGBoostRanker.scala
+++ b/jvm-packages/xgboost4j-spark/src/main/scala/ml/dmlc/xgboost4j/scala/spark/XGBoostRanker.scala
@@ -22,11 +22,12 @@ import org.apache.spark.ml.param.ParamMap
import org.apache.spark.ml.util.{DefaultParamsReadable, Identifiable, MLReadable, MLReader}
import org.apache.spark.ml.xgboost.SparkUtils
import org.apache.spark.sql.Dataset
+import org.apache.spark.sql.types.{DataType, DoubleType, StructType}
+
import ml.dmlc.xgboost4j.scala.Booster
import ml.dmlc.xgboost4j.scala.spark.XGBoostRanker._uid
import ml.dmlc.xgboost4j.scala.spark.params.HasGroupCol
import ml.dmlc.xgboost4j.scala.spark.params.LearningTaskParams.RANKER_OBJS
-import org.apache.spark.sql.types.{DataType, DoubleType, StructType}
class XGBoostRanker(override val uid: String,
private val xgboostParams: Map[String, Any])
diff --git a/jvm-packages/xgboost4j-spark/src/main/scala/ml/dmlc/xgboost4j/scala/spark/XGBoostRegressor.scala b/jvm-packages/xgboost4j-spark/src/main/scala/ml/dmlc/xgboost4j/scala/spark/XGBoostRegressor.scala
index 6d127a468..5bff09117 100644
--- a/jvm-packages/xgboost4j-spark/src/main/scala/ml/dmlc/xgboost4j/scala/spark/XGBoostRegressor.scala
+++ b/jvm-packages/xgboost4j-spark/src/main/scala/ml/dmlc/xgboost4j/scala/spark/XGBoostRegressor.scala
@@ -22,11 +22,11 @@ import org.apache.spark.ml.param.ParamMap
import org.apache.spark.ml.util.{DefaultParamsReadable, Identifiable, MLReadable, MLReader}
import org.apache.spark.ml.xgboost.SparkUtils
import org.apache.spark.sql.Dataset
+import org.apache.spark.sql.types.{DataType, DoubleType, StructType}
import ml.dmlc.xgboost4j.scala.Booster
import ml.dmlc.xgboost4j.scala.spark.XGBoostRegressor._uid
import ml.dmlc.xgboost4j.scala.spark.params.LearningTaskParams.REGRESSION_OBJS
-import org.apache.spark.sql.types.{DataType, DoubleType, StructType}
class XGBoostRegressor(override val uid: String,
private val xgboostParams: Map[String, Any])
diff --git a/jvm-packages/xgboost4j-spark/src/test/scala/ml/dmlc/xgboost4j/scala/spark/XGBoostEstimatorSuite.scala b/jvm-packages/xgboost4j-spark/src/test/scala/ml/dmlc/xgboost4j/scala/spark/XGBoostEstimatorSuite.scala
index 8895789ba..de0b8e3dd 100644
--- a/jvm-packages/xgboost4j-spark/src/test/scala/ml/dmlc/xgboost4j/scala/spark/XGBoostEstimatorSuite.scala
+++ b/jvm-packages/xgboost4j-spark/src/test/scala/ml/dmlc/xgboost4j/scala/spark/XGBoostEstimatorSuite.scala
@@ -18,10 +18,11 @@ package ml.dmlc.xgboost4j.scala.spark
import java.io.File
import java.util.Arrays
+
import scala.collection.mutable.ArrayBuffer
-import org.apache.spark.ml.linalg.{DenseVector, SparseVector, Vectors}
import org.apache.spark.SparkException
+import org.apache.spark.ml.linalg.{DenseVector, SparseVector, Vectors}
import org.json4s.{DefaultFormats, Formats}
import org.json4s.jackson.parseJson
import org.scalatest.funsuite.AnyFunSuite