From aded0270fd9ed81aa187d67e5e5a44ab7cb86873 Mon Sep 17 00:00:00 2001 From: Marcelo Vanzin Date: Wed, 2 Dec 2015 17:34:20 -0800 Subject: [PATCH 1/3] [SPARK-3873] [build] Add scalastyle checker for import ordering. Currently generates only warnings, since there are many violations. dev/scalastyle was modified to not get rid of the output file, since that contains the list of warnigs which could help with cleaning things up. --- dev/scalastyle | 4 +++- pom.xml | 2 +- project/plugins.sbt | 2 +- scalastyle-config.xml | 12 ++++++++++++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/dev/scalastyle b/dev/scalastyle index ad93f7e85b27..945f9ffe2135 100755 --- a/dev/scalastyle +++ b/dev/scalastyle @@ -24,7 +24,9 @@ echo -e "q\n" | build/sbt -Pkinesis-asl -Pyarn -Phadoop-2.2 scalastyle >> scalas echo -e "q\n" | build/sbt -Pkinesis-asl -Pyarn -Phadoop-2.2 test:scalastyle >> scalastyle.txt ERRORS=$(cat scalastyle.txt | awk '{if($1~/error/)print}') -rm scalastyle.txt +mkdir -p target +rm -f target/scalastyle.txt +mv scalastyle.txt target/ if test ! -z "$ERRORS"; then echo -e "Scalastyle checks failed at following occurrences:\n$ERRORS" diff --git a/pom.xml b/pom.xml index 234fd5dea1a6..115ed25bfd1d 100644 --- a/pom.xml +++ b/pom.xml @@ -2235,7 +2235,7 @@ org.scalastyle scalastyle-maven-plugin - 0.7.0 + 0.8.0 false true diff --git a/project/plugins.sbt b/project/plugins.sbt index c06687d8f197..2873fa463d32 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -17,7 +17,7 @@ addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.6.0") addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.7.4") -addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "0.7.0") +addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "0.8.0") addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.1.6") diff --git a/scalastyle-config.xml b/scalastyle-config.xml index 050c3f360476..a09292b5f3af 100644 --- a/scalastyle-config.xml +++ b/scalastyle-config.xml @@ -203,6 +203,18 @@ This file is divided into 3 sections: + + + + java,scala,3rdParty,spark + javax?\..+ + scala\..+ + (?!org\.apache\.spark\.).* + org\.apache\.spark\..* + + + + From c1e55565ceca81dd3cb20f5e01a47e9f4f8cc6fb Mon Sep 17 00:00:00 2001 From: Marcelo Vanzin Date: Thu, 3 Dec 2015 09:11:38 -0800 Subject: [PATCH 2/3] Cleanup scalastyle script a little. --- dev/scalastyle | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/dev/scalastyle b/dev/scalastyle index 945f9ffe2135..b16054cffb41 100755 --- a/dev/scalastyle +++ b/dev/scalastyle @@ -17,16 +17,15 @@ # limitations under the License. # -echo -e "q\n" | build/sbt -Pkinesis-asl -Phive -Phive-thriftserver scalastyle > scalastyle.txt -echo -e "q\n" | build/sbt -Pkinesis-asl -Phive -Phive-thriftserver test:scalastyle >> scalastyle.txt +mkdir -p target +OUTPUT="target/scalastyle.txt" +echo -e "q\n" | build/sbt -Pkinesis-asl -Phive -Phive-thriftserver scalastyle > "$OUTPUT" +echo -e "q\n" | build/sbt -Pkinesis-asl -Phive -Phive-thriftserver test:scalastyle >> "$OUTPUT" # Check style with YARN built too -echo -e "q\n" | build/sbt -Pkinesis-asl -Pyarn -Phadoop-2.2 scalastyle >> scalastyle.txt -echo -e "q\n" | build/sbt -Pkinesis-asl -Pyarn -Phadoop-2.2 test:scalastyle >> scalastyle.txt +echo -e "q\n" | build/sbt -Pkinesis-asl -Pyarn -Phadoop-2.2 scalastyle >> "$OUTPUT" +echo -e "q\n" | build/sbt -Pkinesis-asl -Pyarn -Phadoop-2.2 test:scalastyle >> "$OUTPUT" -ERRORS=$(cat scalastyle.txt | awk '{if($1~/error/)print}') -mkdir -p target -rm -f target/scalastyle.txt -mv scalastyle.txt target/ +ERRORS=$(cat "$OUTPUT" | awk '{if($1~/error/)print}') if test ! -z "$ERRORS"; then echo -e "Scalastyle checks failed at following occurrences:\n$ERRORS" From 28e82875655616742fcf64eaaeb76e4f72424c60 Mon Sep 17 00:00:00 2001 From: Marcelo Vanzin Date: Thu, 3 Dec 2015 10:07:16 -0800 Subject: [PATCH 3/3] Fix an unrelated typo. --- scalastyle-config.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scalastyle-config.xml b/scalastyle-config.xml index a09292b5f3af..dab1ebddc666 100644 --- a/scalastyle-config.xml +++ b/scalastyle-config.xml @@ -153,7 +153,7 @@ This file is divided into 3 sections: @VisibleForTesting