You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by tw...@apache.org on 2022/04/12 15:01:39 UTC
[flink] 01/03: [FLINK-26553][build] Add scalafmt for formatting the Scala codebase
This is an automated email from the ASF dual-hosted git repository.
twalthr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git
commit 3ea3fee5ac996f6ae8836c3cba252f974d20bd2e
Author: slinkydeveloper <fr...@gmail.com>
AuthorDate: Wed Mar 9 15:48:16 2022 +0100
[FLINK-26553][build] Add scalafmt for formatting the Scala codebase
Run 'mvn spotless:apply' for auto-formatting the code base. Usually,
IntelliJ should pick it up automatically if the Scala plugin is installed.
This closes #19025.
---
.editorconfig | 4 -
.scalafmt.conf | 70 ++++++++++
.../flink-hadoop-compatibility/pom.xml | 9 --
flink-connectors/flink-hcatalog/pom.xml | 10 --
.../flink-end-to-end-tests-scala/pom.xml | 11 +-
.../test-scripts/test_kubernetes_itcases.sh | 4 +-
.../test-scripts/test_streaming_gcp_pubsub.sh | 5 +-
flink-examples/flink-examples-batch/pom.xml | 9 --
flink-examples/flink-examples-streaming/pom.xml | 9 --
flink-libraries/flink-cep-scala/pom.xml | 9 --
flink-libraries/flink-gelly-examples/pom.xml | 9 --
flink-libraries/flink-gelly-scala/pom.xml | 9 --
.../scala/org/apache/flink/graph/scala/Graph.scala | 2 -
flink-scala/pom.xml | 9 --
.../apache/flink/api/scala/ClosureCleaner.scala | 4 -
flink-streaming-scala/pom.xml | 9 --
flink-table/flink-table-api-scala-bridge/pom.xml | 9 --
flink-table/flink-table-api-scala/pom.xml | 9 --
flink-table/flink-table-planner/pom.xml | 9 --
flink-tests/pom.xml | 9 --
flink-yarn-tests/pom.xml | 9 --
pom.xml | 64 ++++-----
tools/ci/compile.sh | 6 +-
tools/maven/scalastyle-config.xml | 146 ---------------------
24 files changed, 105 insertions(+), 338 deletions(-)
diff --git a/.editorconfig b/.editorconfig
index 2e260749d26..333c2a16580 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -267,10 +267,6 @@ ij_java_wrap_first_method_in_call_chain = true
indent_style = tab
indent_size = 4
-[*.scala]
-indent_style = space
-indent_size = 2
-
[*.py]
indent_style = space
indent_size = 4
diff --git a/.scalafmt.conf b/.scalafmt.conf
new file mode 100644
index 00000000000..a2ea10cc981
--- /dev/null
+++ b/.scalafmt.conf
@@ -0,0 +1,70 @@
+runner.dialect = scala212
+
+# Version is required to make sure IntelliJ picks the right version
+version = 3.4.3
+preset = default
+
+# Max column
+maxColumn = 100
+
+# This parameter simply says the .stripMargin method was not redefined by the user to assign
+# special meaning to indentation preceding the | character. Hence, that indentation can be modified.
+assumeStandardLibraryStripMargin = true
+align.stripMargin = true
+
+# Align settings
+align.preset = none
+align.closeParenSite = false
+align.openParenCallSite = false
+danglingParentheses.defnSite = false
+danglingParentheses.callSite = false
+danglingParentheses.ctrlSite = true
+danglingParentheses.tupleSite = false
+align.openParenCallSite = false
+align.openParenDefnSite = false
+align.openParenTupleSite = false
+
+# Newlines
+newlines.alwaysBeforeElseAfterCurlyIf = false
+newlines.beforeCurlyLambdaParams = multiline # Newline before lambda params
+newlines.afterCurlyLambdaParams = squash # No newline after lambda params
+newlines.inInterpolation = "avoid"
+newlines.avoidInResultType = true
+optIn.annotationNewlines = true
+
+# Scaladoc
+docstrings.style = Asterisk # Javadoc style
+docstrings.removeEmpty = true
+docstrings.oneline = fold
+docstrings.forceBlankLineBefore = true
+
+# Indentation
+indent.extendSite = 2 # This makes sure extend is not indented as the ctor parameters
+
+# Rewrites
+rewrite.rules = [AvoidInfix, Imports, RedundantBraces, SortModifiers]
+
+# Imports
+rewrite.imports.sort = scalastyle
+rewrite.imports.groups = [
+ ["org.apache.flink\\..*"],
+ ["org.apache.flink.shaded\\..*"],
+ [".*"],
+ ["javax\\..*"],
+ ["java\\..*"],
+ ["scala\\..*"]
+]
+rewrite.imports.contiguousGroups = no
+importSelectors = singleline # Imports in a single line, like IntelliJ
+
+# Remove redundant braces in string interpolation.
+rewrite.redundantBraces.stringInterpolation = true
+rewrite.redundantBraces.defnBodies = false
+rewrite.redundantBraces.generalExpressions = false
+rewrite.redundantBraces.ifElseExpressions = false
+rewrite.redundantBraces.methodBodies = false
+rewrite.redundantBraces.includeUnitMethods = false
+rewrite.redundantBraces.maxBreaks = 1
+
+# Remove trailing commas
+rewrite.trailingCommas.style = "never"
diff --git a/flink-connectors/flink-hadoop-compatibility/pom.xml b/flink-connectors/flink-hadoop-compatibility/pom.xml
index 98aa645da31..6d087667445 100644
--- a/flink-connectors/flink-hadoop-compatibility/pom.xml
+++ b/flink-connectors/flink-hadoop-compatibility/pom.xml
@@ -178,15 +178,6 @@ under the License.
</executions>
</plugin>
- <!-- Scala Code Style, most of the configuration done via plugin management -->
- <plugin>
- <groupId>org.scalastyle</groupId>
- <artifactId>scalastyle-maven-plugin</artifactId>
- <configuration>
- <configLocation>${project.basedir}/../../tools/maven/scalastyle-config.xml</configLocation>
- </configuration>
- </plugin>
-
<!-- Add test classes to test jar in order to test WritableTypeInfo. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
diff --git a/flink-connectors/flink-hcatalog/pom.xml b/flink-connectors/flink-hcatalog/pom.xml
index a46ea4bd6d4..aceedb7cc2a 100644
--- a/flink-connectors/flink-hcatalog/pom.xml
+++ b/flink-connectors/flink-hcatalog/pom.xml
@@ -192,16 +192,6 @@ under the License.
</execution>
</executions>
</plugin>
-
- <!-- Scala Code Style, most of the configuration done via plugin management -->
- <plugin>
- <groupId>org.scalastyle</groupId>
- <artifactId>scalastyle-maven-plugin</artifactId>
- <configuration>
- <configLocation>${project.basedir}/../../tools/maven/scalastyle-config.xml</configLocation>
- </configuration>
- </plugin>
-
</plugins>
</build>
diff --git a/flink-end-to-end-tests/flink-end-to-end-tests-scala/pom.xml b/flink-end-to-end-tests/flink-end-to-end-tests-scala/pom.xml
index 913818a1a4c..5263c29ab6b 100644
--- a/flink-end-to-end-tests/flink-end-to-end-tests-scala/pom.xml
+++ b/flink-end-to-end-tests/flink-end-to-end-tests-scala/pom.xml
@@ -202,15 +202,6 @@ under the License.
</executions>
</plugin>
- <!-- Scala Code Style, most of the configuration done via plugin management -->
- <plugin>
- <groupId>org.scalastyle</groupId>
- <artifactId>scalastyle-maven-plugin</artifactId>
- <configuration>
- <configLocation>${project.basedir}/../../tools/maven/scalastyle-config.xml</configLocation>
- </configuration>
- </plugin>
-
<!-- Add Scala test classes to test jar in order to test Scala type information. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -226,4 +217,4 @@ under the License.
</plugins>
</build>
-</project>
\ No newline at end of file
+</project>
diff --git a/flink-end-to-end-tests/test-scripts/test_kubernetes_itcases.sh b/flink-end-to-end-tests/test-scripts/test_kubernetes_itcases.sh
index 6ff1a9fff73..18dca21fe3e 100755
--- a/flink-end-to-end-tests/test-scripts/test_kubernetes_itcases.sh
+++ b/flink-end-to-end-tests/test-scripts/test_kubernetes_itcases.sh
@@ -32,7 +32,7 @@ MVN_LOGGING_OPTIONS="-Dlog.dir=${DEBUG_FILES_OUTPUT_DIR} -Dlog4j.configurationFi
function run_mvn_test {
local test_class=$1
- run_mvn test $MVN_LOGGING_OPTIONS -Dtest=${test_class}
+ run_mvn test -pl flink-kubernetes $MVN_LOGGING_OPTIONS -Dtest=${test_class}
EXIT_CODE=$?
if [ $EXIT_CODE != 0 ]; then
@@ -41,7 +41,7 @@ function run_mvn_test {
fi
}
-cd $END_TO_END_DIR/../flink-kubernetes
+cd $END_TO_END_DIR/..
# Run the ITCases
run_mvn_test org.apache.flink.kubernetes.kubeclient.Fabric8FlinkKubeClientITCase
diff --git a/flink-end-to-end-tests/test-scripts/test_streaming_gcp_pubsub.sh b/flink-end-to-end-tests/test-scripts/test_streaming_gcp_pubsub.sh
index 625d818c442..99f11003126 100755
--- a/flink-end-to-end-tests/test-scripts/test_streaming_gcp_pubsub.sh
+++ b/flink-end-to-end-tests/test-scripts/test_streaming_gcp_pubsub.sh
@@ -18,7 +18,4 @@
################################################################################
# This test is a Java end to end test, but it requires Docker. Therefore, we run it from bash.
-
-cd "${END_TO_END_DIR}/flink-connector-gcp-pubsub-emulator-tests"
-
-run_mvn test -DskipTests=false
+run_mvn test -DskipTests=false -pl flink-end-to-end-tests/flink-connector-gcp-pubsub-emulator-tests
diff --git a/flink-examples/flink-examples-batch/pom.xml b/flink-examples/flink-examples-batch/pom.xml
index 711e008f2c4..88d6e3031fe 100644
--- a/flink-examples/flink-examples-batch/pom.xml
+++ b/flink-examples/flink-examples-batch/pom.xml
@@ -164,15 +164,6 @@ under the License.
</execution>
</executions>
</plugin>
-
- <!-- Scala Code Style, most of the configuration done via plugin management -->
- <plugin>
- <groupId>org.scalastyle</groupId>
- <artifactId>scalastyle-maven-plugin</artifactId>
- <configuration>
- <configLocation>${project.basedir}/../../tools/maven/scalastyle-config.xml</configLocation>
- </configuration>
- </plugin>
<!-- create the example JAR files -->
<plugin>
diff --git a/flink-examples/flink-examples-streaming/pom.xml b/flink-examples/flink-examples-streaming/pom.xml
index 4c27fee9c97..0a6fe0ecb96 100644
--- a/flink-examples/flink-examples-streaming/pom.xml
+++ b/flink-examples/flink-examples-streaming/pom.xml
@@ -143,15 +143,6 @@ under the License.
</executions>
</plugin>
- <!-- Scala Code Style, most of the configuration done via plugin management -->
- <plugin>
- <groupId>org.scalastyle</groupId>
- <artifactId>scalastyle-maven-plugin</artifactId>
- <configuration>
- <configLocation>${project.basedir}/../../tools/maven/scalastyle-config.xml</configLocation>
- </configuration>
- </plugin>
-
<!-- self-contained jars for each example -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
diff --git a/flink-libraries/flink-cep-scala/pom.xml b/flink-libraries/flink-cep-scala/pom.xml
index c61ad2b7c77..04cc252e42a 100644
--- a/flink-libraries/flink-cep-scala/pom.xml
+++ b/flink-libraries/flink-cep-scala/pom.xml
@@ -122,15 +122,6 @@ under the License.
</execution>
</executions>
</plugin>
-
- <!-- Scala Code Style, most of the configuration done via plugin management -->
- <plugin>
- <groupId>org.scalastyle</groupId>
- <artifactId>scalastyle-maven-plugin</artifactId>
- <configuration>
- <configLocation>${project.basedir}/../../tools/maven/scalastyle-config.xml</configLocation>
- </configuration>
- </plugin>
<!-- Adding scala source directories to build path for Eclipse and generating the sources jar -->
<plugin>
diff --git a/flink-libraries/flink-gelly-examples/pom.xml b/flink-libraries/flink-gelly-examples/pom.xml
index 36c94494afd..90ab421bb2a 100644
--- a/flink-libraries/flink-gelly-examples/pom.xml
+++ b/flink-libraries/flink-gelly-examples/pom.xml
@@ -236,15 +236,6 @@
</execution>
</executions>
</plugin>
-
- <!-- Scala Code Style, most of the configuration done via plugin management -->
- <plugin>
- <groupId>org.scalastyle</groupId>
- <artifactId>scalastyle-maven-plugin</artifactId>
- <configuration>
- <configLocation>${project.basedir}/../../tools/maven/scalastyle-config.xml</configLocation>
- </configuration>
- </plugin>
</plugins>
</build>
diff --git a/flink-libraries/flink-gelly-scala/pom.xml b/flink-libraries/flink-gelly-scala/pom.xml
index 462de1aef2a..cf6c823c292 100644
--- a/flink-libraries/flink-gelly-scala/pom.xml
+++ b/flink-libraries/flink-gelly-scala/pom.xml
@@ -199,15 +199,6 @@ under the License.
</executions>
</plugin>
- <!-- Scala Code Style, most of the configuration done via plugin management -->
- <plugin>
- <groupId>org.scalastyle</groupId>
- <artifactId>scalastyle-maven-plugin</artifactId>
- <configuration>
- <configLocation>${project.basedir}/../../tools/maven/scalastyle-config.xml</configLocation>
- </configuration>
- </plugin>
-
<!-- build a jar-with-dependencies, to be included in the 'opt' build folder -->
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
diff --git a/flink-libraries/flink-gelly-scala/src/main/scala/org/apache/flink/graph/scala/Graph.scala b/flink-libraries/flink-gelly-scala/src/main/scala/org/apache/flink/graph/scala/Graph.scala
index 4609c5e0095..df7b8c10822 100644
--- a/flink-libraries/flink-gelly-scala/src/main/scala/org/apache/flink/graph/scala/Graph.scala
+++ b/flink-libraries/flink-gelly-scala/src/main/scala/org/apache/flink/graph/scala/Graph.scala
@@ -218,7 +218,6 @@ object Graph {
* @tparam EV Edge value type
* @return Graph with vertices and edges read from the given files.
*/
- // scalastyle:off
// This method exceeds the max allowed number of parameters -->
def fromCsvReader[
K: TypeInformation : ClassTag,
@@ -290,7 +289,6 @@ object Graph {
}
}
}
- // scalastyle:on
}
/**
diff --git a/flink-scala/pom.xml b/flink-scala/pom.xml
index 26447c91f44..c655ee78620 100644
--- a/flink-scala/pom.xml
+++ b/flink-scala/pom.xml
@@ -252,15 +252,6 @@ under the License.
</executions>
</plugin>
- <!-- Scala Code Style, most of the configuration done via plugin management -->
- <plugin>
- <groupId>org.scalastyle</groupId>
- <artifactId>scalastyle-maven-plugin</artifactId>
- <configuration>
- <configLocation>${project.basedir}/../tools/maven/scalastyle-config.xml</configLocation>
- </configuration>
- </plugin>
-
<!-- Add Scala test classes to test jar in order to test Scala type information. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
diff --git a/flink-scala/src/main/scala/org/apache/flink/api/scala/ClosureCleaner.scala b/flink-scala/src/main/scala/org/apache/flink/api/scala/ClosureCleaner.scala
index 6e6e536fd14..3ad71ea5d4b 100644
--- a/flink-scala/src/main/scala/org/apache/flink/api/scala/ClosureCleaner.scala
+++ b/flink-scala/src/main/scala/org/apache/flink/api/scala/ClosureCleaner.scala
@@ -381,10 +381,8 @@ object ClosureCleaner {
} else {
LOG.debug(s"Cleaning lambda: ${lambdaFunc.get.getImplMethodName}")
- // scalastyle:off classforname
val captClass = Class.forName(lambdaFunc.get.getCapturingClass.replace('/', '.'),
false, Thread.currentThread.getContextClassLoader)
- // scalastyle:on classforname
// Fail fast if we detect return statements in closures
getClassReader(captClass)
.accept(new ReturnStatementFinder(Some(lambdaFunc.get.getImplMethodName)), 0)
@@ -593,12 +591,10 @@ private class InnerClosureFinder(output: Set[Class[_]]) extends ClassVisitor(ASM
if (op == INVOKESPECIAL && name == "<init>" && argTypes.length > 0
&& argTypes(0).toString.startsWith("L") // is it an object?
&& argTypes(0).getInternalName == myName) {
- // scalastyle:off classforname
output += Class.forName(
owner.replace('/', '.'),
false,
Thread.currentThread.getContextClassLoader)
- // scalastyle:on classforname
}
}
}
diff --git a/flink-streaming-scala/pom.xml b/flink-streaming-scala/pom.xml
index 4377a5cdbc5..eadcb152712 100644
--- a/flink-streaming-scala/pom.xml
+++ b/flink-streaming-scala/pom.xml
@@ -238,15 +238,6 @@ under the License.
</executions>
</plugin>
- <!-- Scala Code Style, most of the configuration done via plugin management -->
- <plugin>
- <groupId>org.scalastyle</groupId>
- <artifactId>scalastyle-maven-plugin</artifactId>
- <configuration>
- <configLocation>${project.basedir}/../tools/maven/scalastyle-config.xml</configLocation>
- </configuration>
- </plugin>
-
<!-- activate API compatibility checks -->
<plugin>
<groupId>com.github.siom79.japicmp</groupId>
diff --git a/flink-table/flink-table-api-scala-bridge/pom.xml b/flink-table/flink-table-api-scala-bridge/pom.xml
index bdb0507c571..1ec085597a7 100644
--- a/flink-table/flink-table-api-scala-bridge/pom.xml
+++ b/flink-table/flink-table-api-scala-bridge/pom.xml
@@ -103,15 +103,6 @@ under the License.
</execution>
</executions>
</plugin>
-
- <!-- Scala Code Style, most of the configuration done via plugin management -->
- <plugin>
- <groupId>org.scalastyle</groupId>
- <artifactId>scalastyle-maven-plugin</artifactId>
- <configuration>
- <configLocation>${project.basedir}/../../tools/maven/scalastyle-config.xml</configLocation>
- </configuration>
- </plugin>
</plugins>
</build>
</project>
diff --git a/flink-table/flink-table-api-scala/pom.xml b/flink-table/flink-table-api-scala/pom.xml
index f50bed63819..cce16eb07ca 100644
--- a/flink-table/flink-table-api-scala/pom.xml
+++ b/flink-table/flink-table-api-scala/pom.xml
@@ -114,15 +114,6 @@ under the License.
</execution>
</executions>
</plugin>
-
- <!-- Scala Code Style -->
- <plugin>
- <groupId>org.scalastyle</groupId>
- <artifactId>scalastyle-maven-plugin</artifactId>
- <configuration>
- <configLocation>${project.basedir}/../../tools/maven/scalastyle-config.xml</configLocation>
- </configuration>
- </plugin>
</plugins>
</build>
</project>
diff --git a/flink-table/flink-table-planner/pom.xml b/flink-table/flink-table-planner/pom.xml
index 3c69c8d1b4e..1a00865873f 100644
--- a/flink-table/flink-table-planner/pom.xml
+++ b/flink-table/flink-table-planner/pom.xml
@@ -389,15 +389,6 @@ under the License.
</configuration>
</plugin>
- <!-- Scala Code Style, most of the configuration done via plugin management -->
- <plugin>
- <groupId>org.scalastyle</groupId>
- <artifactId>scalastyle-maven-plugin</artifactId>
- <configuration>
- <configLocation>${project.basedir}/../../tools/maven/scalastyle-config.xml</configLocation>
- </configuration>
- </plugin>
-
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
diff --git a/flink-tests/pom.xml b/flink-tests/pom.xml
index f8a39146c3b..d5ea8c789dd 100644
--- a/flink-tests/pom.xml
+++ b/flink-tests/pom.xml
@@ -374,15 +374,6 @@ under the License.
</execution>
</executions>
</plugin>
-
- <!-- Scala Code Style, most of the configuration done via plugin management -->
- <plugin>
- <groupId>org.scalastyle</groupId>
- <artifactId>scalastyle-maven-plugin</artifactId>
- <configuration>
- <configLocation>${project.basedir}/../tools/maven/scalastyle-config.xml</configLocation>
- </configuration>
- </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
diff --git a/flink-yarn-tests/pom.xml b/flink-yarn-tests/pom.xml
index f1fc1e71df4..982d3a30ea3 100644
--- a/flink-yarn-tests/pom.xml
+++ b/flink-yarn-tests/pom.xml
@@ -344,15 +344,6 @@ under the License.
</executions>
</plugin>
- <!-- Scala Code Style, most of the configuration done via plugin management -->
- <plugin>
- <groupId>org.scalastyle</groupId>
- <artifactId>scalastyle-maven-plugin</artifactId>
- <configuration>
- <configLocation>${project.basedir}/../tools/maven/scalastyle-config.xml</configLocation>
- </configuration>
- </plugin>
-
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
diff --git a/pom.xml b/pom.xml
index 3789324b9e2..d76839dcd9b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -157,7 +157,7 @@ under the License.
<hivemetastore.hadoop.version>2.7.5</hivemetastore.hadoop.version>
<japicmp.referenceVersion>1.14.0</japicmp.referenceVersion>
<japicmp.outputDir>tools/japicmp-output</japicmp.outputDir>
- <spotless.version>2.4.2</spotless.version>
+ <spotless.version>2.13.0</spotless.version>
<!-- Can be set to any value to reproduce a specific build. -->
<test.randomization.seed/>
@@ -1062,13 +1062,6 @@ under the License.
<skip>true</skip>
</configuration>
</plugin>
- <plugin>
- <groupId>org.scalastyle</groupId>
- <artifactId>scalastyle-maven-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
@@ -1520,7 +1513,6 @@ under the License.
<!-- Generated content -->
<exclude>out/**</exclude>
<exclude>**/target/**</exclude>
- <exclude>**/scalastyle-output.xml</exclude>
<exclude>build-target/**</exclude>
<exclude>docs/layouts/shortcodes/generated/**</exclude>
<exclude>docs/static/generated/**</exclude>
@@ -1963,6 +1955,34 @@ under the License.
<removeUnusedImports />
</java>
+ <scala>
+ <scalafmt>
+ <version>3.4.3</version>
+ <!-- This file is in the root of the project to make sure IntelliJ picks it up automatically -->
+ <file>.scalafmt.conf</file>
+ </scalafmt>
+ <licenseHeader>
+ <content>/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+</content>
+ <delimiter>package </delimiter>
+ </licenseHeader>
+ </scala>
</configuration>
<executions>
<execution>
@@ -2058,32 +2078,6 @@ under the License.
</executions>
</plugin>
- <!-- configure scala style -->
- <plugin>
- <groupId>org.scalastyle</groupId>
- <artifactId>scalastyle-maven-plugin</artifactId>
- <version>1.0.0</version>
- <executions>
- <execution>
- <phase>validate</phase>
- <goals>
- <goal>check</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <verbose>false</verbose>
- <failOnViolation>true</failOnViolation>
- <includeTestSourceDirectory>true</includeTestSourceDirectory>
- <failOnWarning>false</failOnWarning>
- <sourceDirectory>${basedir}/src/main/scala</sourceDirectory>
- <testSourceDirectory>${basedir}/src/test/scala</testSourceDirectory>
- <outputFile>${project.basedir}/target/scalastyle-output.xml</outputFile>
- <inputEncoding>UTF-8</inputEncoding>
- <outputEncoding>UTF-8</outputEncoding>
- </configuration>
- </plugin>
-
<!-- set scala maven plugin version -->
<plugin>
<groupId>net.alchim31.maven</groupId>
diff --git a/tools/ci/compile.sh b/tools/ci/compile.sh
index e6013f9650f..591e749d514 100755
--- a/tools/ci/compile.sh
+++ b/tools/ci/compile.sh
@@ -71,7 +71,7 @@ echo "============ Checking Javadocs ============"
# use the same invocation as on buildbot (https://svn.apache.org/repos/infra/infrastructure/buildbot/aegis/buildmaster/master1/projects/flink.conf)
run_mvn javadoc:aggregate -Paggregate-scaladoc -DadditionalJOption='-Xdoclint:none' \
- -Dmaven.javadoc.failOnError=false -Dcheckstyle.skip=true -Denforcer.skip=true \
+ -Dmaven.javadoc.failOnError=false -Dcheckstyle.skip=true -Denforcer.skip=true -Dspotless.skip=true \
-Dheader=someTestHeader > javadoc.out
EXIT_CODE=$?
if [ $EXIT_CODE != 0 ] ; then
@@ -82,15 +82,13 @@ fi
echo "============ Checking Scaladocs ============"
-cd flink-scala
-run_mvn scala:doc 2> scaladoc.out
+run_mvn scala:doc -Dcheckstyle.skip=true -Denforcer.skip=true -Dspotless.skip=true -pl flink-scala 2> scaladoc.out
EXIT_CODE=$?
if [ $EXIT_CODE != 0 ] ; then
echo "ERROR in Scaladocs. Printing full output:"
cat scaladoc.out ; rm scaladoc.out
exit $EXIT_CODE
fi
-cd ..
echo "============ Checking scala suffixes ============"
diff --git a/tools/maven/scalastyle-config.xml b/tools/maven/scalastyle-config.xml
deleted file mode 100644
index 53b10529d16..00000000000
--- a/tools/maven/scalastyle-config.xml
+++ /dev/null
@@ -1,146 +0,0 @@
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ 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.
- -->
-<!-- NOTE: This was taken and adapted from Apache Spark. -->
-
-<!-- If you wish to turn off checking for a section of code, you can put a comment in the source
- before and after the section, with the following syntax: -->
-<!-- // scalastyle:off -->
-<!-- ... -->
-<!-- // naughty stuff -->
-<!-- ... -->
-<!-- // scalastyle:on -->
-
-<scalastyle>
- <name>Scalastyle standard configuration</name>
- <check level="error" class="org.scalastyle.file.FileTabChecker" enabled="true" />
- <!-- <check level="error" class="org.scalastyle.file.FileLengthChecker" enabled="true"> -->
- <!-- <parameters> -->
- <!-- <parameter name="maxFileLength"><![CDATA[800]]></parameter> -->
- <!-- </parameters> -->
- <!-- </check> -->
- <check level="error" class="org.scalastyle.file.HeaderMatchesChecker" enabled="true">
- <parameters>
- <parameter name="header"><![CDATA[/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */]]></parameter>
- </parameters>
- </check>
- <check level="error" class="org.scalastyle.scalariform.SpacesAfterPlusChecker" enabled="true" />
- <check level="error" class="org.scalastyle.file.WhitespaceEndOfLineChecker" enabled="false" />
- <check level="error" class="org.scalastyle.scalariform.SpacesBeforePlusChecker" enabled="true" />
- <check level="error" class="org.scalastyle.file.FileLineLengthChecker" enabled="true">
- <parameters>
- <parameter name="maxLineLength"><![CDATA[100]]></parameter>
- <parameter name="tabSize"><![CDATA[2]]></parameter>
- <parameter name="ignoreImports">true</parameter>
- </parameters>
- </check>
- <check level="error" class="org.scalastyle.scalariform.ClassNamesChecker" enabled="true">
- <parameters>
- <parameter name="regex"><![CDATA[[A-Z][A-Za-z]*]]></parameter>
- </parameters>
- </check>
- <check level="error" class="org.scalastyle.scalariform.ObjectNamesChecker" enabled="true">
- <parameters>
- <parameter name="regex"><![CDATA[[A-Z][A-Za-z]*]]></parameter>
- </parameters>
- </check>
- <check level="error" class="org.scalastyle.scalariform.PackageObjectNamesChecker" enabled="true">
- <parameters>
- <parameter name="regex"><![CDATA[^[a-z][A-Za-z]*$]]></parameter>
- </parameters>
- </check>
- <check level="error" class="org.scalastyle.scalariform.EqualsHashCodeChecker" enabled="false" />
- <!-- <check level="error" class="org.scalastyle.scalariform.IllegalImportsChecker" enabled="true"> -->
- <!-- <parameters> -->
- <!-- <parameter name="illegalImports"><![CDATA[sun._,java.awt._]]></parameter> -->
- <!-- </parameters> -->
- <!-- </check> -->
- <check level="error" class="org.scalastyle.scalariform.ParameterNumberChecker" enabled="true">
- <parameters>
- <parameter name="maxParameters"><![CDATA[20]]></parameter>
- </parameters>
- </check>
- <!-- <check level="error" class="org.scalastyle.scalariform.MagicNumberChecker" enabled="true"> -->
- <!-- <parameters> -->
- <!-- <parameter name="ignore"><![CDATA[-1,0,1,2,3]]></parameter> -->
- <!-- </parameters> -->
- <!-- </check> -->
- <check level="error" class="org.scalastyle.scalariform.NoWhitespaceBeforeLeftBracketChecker" enabled="false" />
- <check level="error" class="org.scalastyle.scalariform.NoWhitespaceAfterLeftBracketChecker" enabled="false" />
- <!-- <check level="error" class="org.scalastyle.scalariform.ReturnChecker" enabled="true" /> -->
- <!-- <check level="error" class="org.scalastyle.scalariform.NullChecker" enabled="true" /> -->
- <!-- <check level="error" class="org.scalastyle.scalariform.NoCloneChecker" enabled="true" /> -->
- <!-- <check level="error" class="org.scalastyle.scalariform.NoFinalizeChecker" enabled="true" /> -->
- <!-- <check level="error" class="org.scalastyle.scalariform.CovariantEqualsChecker" enabled="true" /> -->
- <!-- <check level="error" class="org.scalastyle.scalariform.StructuralTypeChecker" enabled="true" /> -->
- <!-- <check level="error" class="org.scalastyle.file.RegexChecker" enabled="true"> -->
- <!-- <parameters> -->
- <!-- <parameter name="regex"><![CDATA[println]]></parameter> -->
- <!-- </parameters> -->
- <!-- </check> -->
- <!-- <check level="error" class="org.scalastyle.scalariform.NumberOfTypesChecker" enabled="true"> -->
- <!-- <parameters> -->
- <!-- <parameter name="maxTypes"><![CDATA[30]]></parameter> -->
- <!-- </parameters> -->
- <!-- </check> -->
- <!-- <check level="error" class="org.scalastyle.scalariform.CyclomaticComplexityChecker" enabled="true"> -->
- <!-- <parameters> -->
- <!-- <parameter name="maximum"><![CDATA[10]]></parameter> -->
- <!-- </parameters> -->
- <!-- </check> -->
- <check level="error" class="org.scalastyle.scalariform.UppercaseLChecker" enabled="true" />
- <check level="error" class="org.scalastyle.scalariform.SimplifyBooleanExpressionChecker" enabled="false" />
- <check level="error" class="org.scalastyle.scalariform.IfBraceChecker" enabled="true">
- <parameters>
- <parameter name="singleLineAllowed"><![CDATA[true]]></parameter>
- <parameter name="doubleLineAllowed"><![CDATA[true]]></parameter>
- </parameters>
- </check>
- <!-- <check level="error" class="org.scalastyle.scalariform.MethodLengthChecker" enabled="true"> -->
- <!-- <parameters> -->
- <!-- <parameter name="maxLength"><![CDATA[50]]></parameter> -->
- <!-- </parameters> -->
- <!-- </check> -->
- <!-- <check level="error" class="org.scalastyle.scalariform.MethodNamesChecker" enabled="true"> -->
- <!-- <parameters> -->
- <!-- <parameter name="regex"><![CDATA[^[a-z][A-Za-z0-9]*$]]></parameter> -->
- <!-- </parameters> -->
- <!-- </check> -->
- <!-- <check level="error" class="org.scalastyle.scalariform.NumberOfMethodsInTypeChecker" enabled="true"> -->
- <!-- <parameters> -->
- <!-- <parameter name="maxMethods"><![CDATA[30]]></parameter> -->
- <!-- </parameters> -->
- <!-- </check> -->
- <!-- <check level="error" class="org.scalastyle.scalariform.PublicMethodsHaveTypeChecker" enabled="true" /> -->
- <check level="error" class="org.scalastyle.file.NewLineAtEofChecker" enabled="true" />
- <check level="error" class="org.scalastyle.file.NoNewLineAtEofChecker" enabled="false" />
-</scalastyle>