diff --git a/jvm-packages/checkstyle.xml b/jvm-packages/checkstyle.xml index a926eb720..88ae2122e 100644 --- a/jvm-packages/checkstyle.xml +++ b/jvm-packages/checkstyle.xml @@ -64,6 +64,11 @@ + + + + + @@ -77,11 +82,6 @@ - - - - - diff --git a/jvm-packages/pom.xml b/jvm-packages/pom.xml index 252f3765c..872fce6cf 100644 --- a/jvm-packages/pom.xml +++ b/jvm-packages/pom.xml @@ -385,7 +385,7 @@ org.scalastyle scalastyle-maven-plugin - 0.8.0 + 1.0.0 false true @@ -413,7 +413,7 @@ org.apache.maven.plugins maven-checkstyle-plugin - 2.17 + 3.1.2 checkstyle.xml true diff --git a/jvm-packages/scalastyle-config.xml b/jvm-packages/scalastyle-config.xml index fd4d22e9a..0f74a17fb 100644 --- a/jvm-packages/scalastyle-config.xml +++ b/jvm-packages/scalastyle-config.xml @@ -48,21 +48,22 @@ This file is divided into 3 sections: - true + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\. + See the License for the specific language governing permissions and + limitations under the License\. + \*/]]> diff --git a/jvm-packages/xgboost4j-gpu/src/main/java/ml/dmlc/xgboost4j/gpu/java/CudfUtils.java b/jvm-packages/xgboost4j-gpu/src/main/java/ml/dmlc/xgboost4j/gpu/java/CudfUtils.java index 748024bd9..b63ef7f30 100644 --- a/jvm-packages/xgboost4j-gpu/src/main/java/ml/dmlc/xgboost4j/gpu/java/CudfUtils.java +++ b/jvm-packages/xgboost4j-gpu/src/main/java/ml/dmlc/xgboost4j/gpu/java/CudfUtils.java @@ -90,9 +90,9 @@ class CudfUtils { shapeNode.add(shape); ArrayNode dataNode = objNode.putArray("data"); dataNode.add(ptr) - .add(false); + .add(false); objNode.put("typestr", typeStr) - .put("version", 1); + .put("version", 1); return objNode; } } diff --git a/jvm-packages/xgboost4j-spark/src/main/scala/ml/dmlc/xgboost4j/scala/spark/DataUtils.scala b/jvm-packages/xgboost4j-spark/src/main/scala/ml/dmlc/xgboost4j/scala/spark/DataUtils.scala index 9386dbbff..c95bc178c 100644 --- a/jvm-packages/xgboost4j-spark/src/main/scala/ml/dmlc/xgboost4j/scala/spark/DataUtils.scala +++ b/jvm-packages/xgboost4j-spark/src/main/scala/ml/dmlc/xgboost4j/scala/spark/DataUtils.scala @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 by Contributors + Copyright (c) 2014,2021 by Contributors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -21,10 +21,8 @@ import ml.dmlc.xgboost4j.{LabeledPoint => XGBLabeledPoint} import org.apache.spark.HashPartitioner import org.apache.spark.ml.feature.{LabeledPoint => MLLabeledPoint} import org.apache.spark.ml.linalg.{DenseVector, SparseVector, Vector, Vectors} -import org.apache.spark.ml.param.Param import org.apache.spark.rdd.RDD import org.apache.spark.sql.{Column, DataFrame, Row} -import org.apache.spark.sql.functions.col import org.apache.spark.sql.types.{FloatType, IntegerType} object DataUtils extends Serializable { diff --git a/jvm-packages/xgboost4j-spark/src/main/scala/ml/dmlc/xgboost4j/scala/spark/XGBoost.scala b/jvm-packages/xgboost4j-spark/src/main/scala/ml/dmlc/xgboost4j/scala/spark/XGBoost.scala index 7bebf223e..dbc4a0aa5 100644 --- a/jvm-packages/xgboost4j-spark/src/main/scala/ml/dmlc/xgboost4j/scala/spark/XGBoost.scala +++ b/jvm-packages/xgboost4j-spark/src/main/scala/ml/dmlc/xgboost4j/scala/spark/XGBoost.scala @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 by Contributors + Copyright (c) 2014,2021 by Contributors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -32,7 +32,7 @@ import org.apache.commons.io.FileUtils import org.apache.commons.logging.LogFactory import org.apache.hadoop.fs.FileSystem import org.apache.spark.rdd.RDD -import org.apache.spark.{SparkContext, SparkParallelismTracker, TaskContext, TaskFailedListener} +import org.apache.spark.{SparkContext, SparkParallelismTracker, TaskContext} import org.apache.spark.sql.SparkSession import org.apache.spark.storage.StorageLevel diff --git a/jvm-packages/xgboost4j-spark/src/main/scala/ml/dmlc/xgboost4j/scala/spark/XGBoostClassifier.scala b/jvm-packages/xgboost4j-spark/src/main/scala/ml/dmlc/xgboost4j/scala/spark/XGBoostClassifier.scala index 9f6176047..3e4412c34 100644 --- a/jvm-packages/xgboost4j-spark/src/main/scala/ml/dmlc/xgboost4j/scala/spark/XGBoostClassifier.scala +++ b/jvm-packages/xgboost4j-spark/src/main/scala/ml/dmlc/xgboost4j/scala/spark/XGBoostClassifier.scala @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 by Contributors + Copyright (c) 2014,2021 by Contributors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -26,7 +26,6 @@ import org.apache.spark.broadcast.Broadcast import org.apache.spark.ml.classification._ import org.apache.spark.ml.linalg._ import org.apache.spark.ml.param._ -import org.apache.spark.ml.param.shared.HasWeightCol import org.apache.spark.ml.util._ import org.apache.spark.rdd.RDD import org.apache.spark.sql._ 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 f57fff1e5..0d640bfeb 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 @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 by Contributors + Copyright (c) 2014,2021 by Contributors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ package ml.dmlc.xgboost4j.scala.spark import scala.collection.{AbstractIterator, Iterator, mutable} import scala.collection.JavaConverters._ -import ml.dmlc.xgboost4j.java.{Rabit, XGBoost => JXGBoost} +import ml.dmlc.xgboost4j.java.Rabit import ml.dmlc.xgboost4j.{LabeledPoint => XGBLabeledPoint} import ml.dmlc.xgboost4j.scala.spark.params.{DefaultXGBoostParamsReader, _} import ml.dmlc.xgboost4j.scala.{Booster, DMatrix, XGBoost => SXGBoost} @@ -27,8 +27,7 @@ import ml.dmlc.xgboost4j.scala.{EvalTrait, ObjectiveTrait} import org.apache.hadoop.fs.Path import org.apache.spark.TaskContext -import org.apache.spark.ml.linalg.{DenseVector, SparseVector, Vector} -import org.apache.spark.ml.param.shared.HasWeightCol +import org.apache.spark.ml.linalg.Vector import org.apache.spark.ml.util._ import org.apache.spark.ml._ import org.apache.spark.ml.param._ @@ -37,7 +36,6 @@ import org.apache.spark.sql._ import org.apache.spark.sql.functions._ import org.apache.spark.sql.types._ import org.json4s.DefaultFormats -import scala.collection.mutable.ListBuffer import org.apache.spark.broadcast.Broadcast diff --git a/jvm-packages/xgboost4j-spark/src/main/scala/ml/dmlc/xgboost4j/scala/spark/params/CustomParams.scala b/jvm-packages/xgboost4j-spark/src/main/scala/ml/dmlc/xgboost4j/scala/spark/params/CustomParams.scala index b7f696a23..784be2aa0 100644 --- a/jvm-packages/xgboost4j-spark/src/main/scala/ml/dmlc/xgboost4j/scala/spark/params/CustomParams.scala +++ b/jvm-packages/xgboost4j-spark/src/main/scala/ml/dmlc/xgboost4j/scala/spark/params/CustomParams.scala @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 by Contributors + Copyright (c) 2014,2021 by Contributors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -22,7 +22,6 @@ import org.json4s.{DefaultFormats, Extraction, NoTypeHints} import org.json4s.jackson.JsonMethods.{compact, parse, render} import org.apache.spark.ml.param.{Param, ParamPair, Params} -import org.apache.spark.sql.DataFrame class CustomEvalParam( parent: Params, diff --git a/jvm-packages/xgboost4j-spark/src/main/scala/ml/dmlc/xgboost4j/scala/spark/params/GeneralParams.scala b/jvm-packages/xgboost4j-spark/src/main/scala/ml/dmlc/xgboost4j/scala/spark/params/GeneralParams.scala index dd9e32516..a75f64dd8 100644 --- a/jvm-packages/xgboost4j-spark/src/main/scala/ml/dmlc/xgboost4j/scala/spark/params/GeneralParams.scala +++ b/jvm-packages/xgboost4j-spark/src/main/scala/ml/dmlc/xgboost4j/scala/spark/params/GeneralParams.scala @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 by Contributors + Copyright (c) 2014,2021 by Contributors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -22,14 +22,6 @@ import ml.dmlc.xgboost4j.scala.spark.TrackerConf import org.apache.spark.ml.param._ import scala.collection.mutable -import ml.dmlc.xgboost4j.{LabeledPoint => XGBLabeledPoint} - -import org.apache.spark.ml.linalg.{DenseVector, SparseVector, Vector} -import org.apache.spark.rdd.RDD -import org.apache.spark.sql.{Column, DataFrame, Row} -import org.apache.spark.sql.functions.col -import org.apache.spark.sql.types.{FloatType, IntegerType} - private[spark] trait GeneralParams extends Params { /** diff --git a/jvm-packages/xgboost4j/src/main/java/ml/dmlc/xgboost4j/java/Booster.java b/jvm-packages/xgboost4j/src/main/java/ml/dmlc/xgboost4j/java/Booster.java index 7c69d7786..85b5c2602 100644 --- a/jvm-packages/xgboost4j/src/main/java/ml/dmlc/xgboost4j/java/Booster.java +++ b/jvm-packages/xgboost4j/src/main/java/ml/dmlc/xgboost4j/java/Booster.java @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 by Contributors + Copyright (c) 2014,2021 by Contributors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -436,7 +436,7 @@ public class Booster implements Serializable, KryoSerializable { } public String[] getModelDump(String[] featureNames, boolean withStats, String format) - throws XGBoostError { + throws XGBoostError { int statsFlag = 0; if (withStats) { statsFlag = 1; diff --git a/jvm-packages/xgboost4j/src/main/java/ml/dmlc/xgboost4j/java/RabitTracker.java b/jvm-packages/xgboost4j/src/main/java/ml/dmlc/xgboost4j/java/RabitTracker.java index 58b9b2500..23866d5ba 100644 --- a/jvm-packages/xgboost4j/src/main/java/ml/dmlc/xgboost4j/java/RabitTracker.java +++ b/jvm-packages/xgboost4j/src/main/java/ml/dmlc/xgboost4j/java/RabitTracker.java @@ -1,7 +1,5 @@ package ml.dmlc.xgboost4j.java; - - import java.io.*; import java.util.HashMap; import java.util.Map; @@ -80,7 +78,7 @@ public class RabitTracker implements IRabitTracker { } public RabitTracker(int numWorkers) - throws XGBoostError { + throws XGBoostError { if (numWorkers < 1) { throw new XGBoostError("numWorkers must be greater equal to one"); }