This is an automated email from the ASF dual-hosted git repository.

twalthr pushed a commit to branch release-1.15
in repository https://gitbox.apache.org/repos/asf/flink.git

commit 033273a658a251d3d8734abee4739817839e139f
Author: slinkydeveloper <francescogu...@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 54c1b966faf..7ec965570a5 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 4351c85ed4a..fa222d8bb2b 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 0a514c8165e..03a94cf5371 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 6ead88d94d2..13eecd44db1 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 744463d422f..5d1d0dd5ef2 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 ac0dae0f6d9..19d9c634179 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 d53855f7093..a5dc0070d3d 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 b99752fd686..be918e10c2f 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 3f8b5a1e63a..c4de68fb589 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 bbee28d315c..d6533c3482a 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 9dd3d220721..38381c1ae5a 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 84b79e716ce..fde30cccf6b 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 469a7a3d591..e059cbdbf00 100644
--- a/flink-table/flink-table-planner/pom.xml
+++ b/flink-table/flink-table-planner/pom.xml
@@ -398,15 +398,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 1acd328ea7e..0cfbe29ad93 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 0bb1ac219b6..1b1e1941287 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 edd9a3900d3..a03c6ba60e2 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.15.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/>
@@ -1068,13 +1068,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>
@@ -1526,7 +1519,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>
@@ -1967,6 +1959,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>
@@ -2062,32 +2082,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>

Reply via email to