diff --git a/.github/workflows/backend.yml b/.github/workflows/backend.yml
index 051a93623a3..648d7ff7c97 100644
--- a/.github/workflows/backend.yml
+++ b/.github/workflows/backend.yml
@@ -51,7 +51,7 @@ jobs:
with:
submodules: true
- name: Check code style
- run: ./mvnw --batch-mode --quiet --no-snapshot-updates clean checkstyle:check
+ run: ./mvnw --batch-mode --quiet --no-snapshot-updates clean spotless:check
dead-link:
if: github.repository == 'apache/incubator-seatunnel'
@@ -100,9 +100,8 @@ jobs:
cache: 'maven'
- name: Build distribution tar
run: >-
- ./mvnw -B install scalastyle:check
+ ./mvnw -B install
-D"maven.test.skip"=true
- -D"checkstyle.skip"=true
-D"license.skipAddThirdParty"=true
-D"http.keepAlive"=false
-D"maven.wagon.http.pool"=false
@@ -130,8 +129,6 @@ jobs:
./mvnw -B -q install -DskipTests
-D"maven.test.skip"=true
-D"maven.javadoc.skip"=true
- -D"scalastyle.skip"=true
- -D"checkstyle.skip"=true
-D"license.skipAddThirdParty"
- name: Check Dependencies Licenses
run: tools/dependencies/checkLicense.sh
@@ -155,7 +152,7 @@ jobs:
cache: 'maven'
- name: Run Unit tests
run: |
- ./mvnw -B -T 1C clean verify -D"maven.test.skip"=false -D"checkstyle.skip"=true -D"scalastyle.skip"=true -D"license.skipAddThirdParty"=true --no-snapshot-updates
+ ./mvnw -B -T 1C clean verify -D"maven.test.skip"=false -D"license.skipAddThirdParty"=true --no-snapshot-updates
env:
MAVEN_OPTS: -Xmx2048m
@@ -178,6 +175,6 @@ jobs:
cache: 'maven'
- name: Run Integration tests
run: |
- ./mvnw -T 1C -B verify -DskipUT=true -DskipIT=false -D"checkstyle.skip"=true -D"scalastyle.skip"=true -D"license.skipAddThirdParty"=true --no-snapshot-updates
+ ./mvnw -T 1C -B verify -DskipUT=true -DskipIT=false -D"license.skipAddThirdParty"=true --no-snapshot-updates
env:
MAVEN_OPTS: -Xmx2048m
diff --git a/.github/workflows/codeql.yaml b/.github/workflows/codeql.yaml
index 237bebd08e1..4037603157c 100644
--- a/.github/workflows/codeql.yaml
+++ b/.github/workflows/codeql.yaml
@@ -30,7 +30,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 60
env:
- JAVA_TOOL_OPTIONS: -Xmx2G -Xms2G -Dhttp.keepAlive=false -Dmaven.test.skip=true -Dcheckstyle.skip=true -Dlicense.skipAddThirdParty=true -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.wagon.httpconnectionManager.ttlSeconds=120
+ JAVA_TOOL_OPTIONS: -Xmx2G -Xms2G -Dhttp.keepAlive=false -Dmaven.test.skip=true -Dlicense.skipAddThirdParty=true -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.wagon.httpconnectionManager.ttlSeconds=120
strategy:
fail-fast: false
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
index 1cf4140aa4f..e994fd0f2e8 100644
--- a/.github/workflows/docker.yml
+++ b/.github/workflows/docker.yml
@@ -54,7 +54,6 @@ jobs:
run: |
./mvnw -B package \
-Dmaven.test.skip=true \
- -Dcheckstyle.skip=true \
-Dlicense.skipAddThirdParty=true \
-Dhttp.keepAlive=false \
-Dmaven.wagon.http.pool=false \
diff --git a/.github/workflows/license.yml b/.github/workflows/license.yml
index d9cd901cab8..6ef7f113703 100644
--- a/.github/workflows/license.yml
+++ b/.github/workflows/license.yml
@@ -67,7 +67,7 @@ jobs:
${{ runner.os }}-maven-
- name: Generate THIRD-PARTY
run: |
- ./mvnw clean license:aggregate-add-third-party -DskipTests -Dcheckstyle.skip -U
+ ./mvnw clean license:aggregate-add-third-party -DskipTests -U
- name: Check LICENSE file
run: |
python3 tools/dependencies/license.py seatunnel-dist/target/THIRD-PARTY.txt seatunnel-dist/release-docs/LICENSE true
diff --git a/.github/workflows/publish-docker.yaml b/.github/workflows/publish-docker.yaml
index c2ffb5b433a..e3b53331a5a 100644
--- a/.github/workflows/publish-docker.yaml
+++ b/.github/workflows/publish-docker.yaml
@@ -68,7 +68,6 @@ jobs:
./mvnw -B clean deploy \
-Dmaven.test.skip \
-Dmaven.javadoc.skip \
- -Dmaven.checkstyle.skip \
-Dlicense.skipAddThirdParty=true \
-Dmaven.deploy.skip \
-Ddocker.tag=${{ github.sha }} \
diff --git a/docs/en/contribution/setup.md b/docs/en/contribution/setup.md
index 5191d39ea81..8b0feb868df 100644
--- a/docs/en/contribution/setup.md
+++ b/docs/en/contribution/setup.md
@@ -36,7 +36,9 @@ Otherwise, your code could not start in JetBrains IntelliJ IDEA correctly.
```
### Building SeaTunnel from source
+
After you install the maven, you can use the follow command to compile and package.
+
```
mvn clean package -pl seatunnel-dist -am -Dmaven.test.skip=true
```
@@ -52,13 +54,19 @@ See [install plugins for IDEA](https://www.jetbrains.com/help/idea/managing-plug
Before running the following example, you should also install JetBrains IntelliJ IDEA's [Lombok plugin](https://plugins.jetbrains.com/plugin/6317-lombok).
See [install plugins for IDEA](https://www.jetbrains.com/help/idea/managing-plugins.html#install-plugins) if you want to.
-### Install JetBrains IDEA CheckStyle-IDEA Plugin
+### Code Style
-Before coding, you should also install JetBrains IntelliJ IDEA's [CheckStyle-IDEA plugin](https://plugins.jetbrains.com/plugin/1065-checkstyle-idea).
-See [install plugins for IDEA](https://www.jetbrains.com/help/idea/managing-plugins.html#install-plugins) if you want to.
-Next, you should go to `Preferences -> Editor -> Code style -> Scheme -> Import Scheme -> CheckStyle Configration` and import `tools/checkstyle/checkStyle.xml`
-![checkstyle.png](../images/checkstyle.png)
-If you want to change to automatically formatting, these configurations are also required.
+SeaTunnel uses `Spotless` for code style and formatting checks.
+You could run the following command and `Spotless` will automatically fix
+the code style and formatting errors for you:
+
+```shell
+./mvnw spotless:apply
+```
+
+You could copy the `pre-commit hook` file `/tools/style/pre-commit` to your `.git/hooks/`
+directory so that every time you commit your code with `git commit`, `Spotless` will automatically
+fix things for you.
## Run Simple Example
@@ -69,7 +77,6 @@ it in IDEA](https://www.jetbrains.com/help/idea/run-debug-configuration.html) as
Here we use `seatunnel-examples/seatunnel-flink-examples/src/main/java/org/apache/seatunnel/example/flink/LocalFlinkExample.java`
as an example, when you run it successfully you could see the output as below:
-
```log
+I[Ricky Huo, 71]
+I[Gary, 12]
@@ -83,7 +90,7 @@ as an example, when you run it successfully you could see the output as below:
All our examples use simple source and sink to make it less dependent and easy to run. You can change the example configuration
in `resources/examples`. You could change your configuration as below, if you want to use PostgreSQL as the source and
-sink to console.
+sink to console.
```conf
env {
@@ -103,3 +110,4 @@ sink {
ConsoleSink {}
}
```
+
diff --git a/docs/en/transform/nullRate.md b/docs/en/transform/nullRate.md
index a5c7bf1ebaa..5718f73d8ef 100644
--- a/docs/en/transform/nullRate.md
+++ b/docs/en/transform/nullRate.md
@@ -14,14 +14,12 @@ This transform **ONLY** supported by Spark.
## Options
-| name | type | required | default value |
-| -------------------------| ------------ | -------- | ------------- |
-| fields | string_list | yes | - |
-| rates | double_list | yes | - |
-| throw_exception_enable | boolean | no | - |
-| save_to_table_name | string | no | - |
-
-
+| name | type | required | default value |
+|------------------------|-------------|----------|---------------|
+| fields | string_list | yes | - |
+| rates | double_list | yes | - |
+| throw_exception_enable | boolean | no | - |
+| save_to_table_name | string | no | - |
### field [string_list]
@@ -58,12 +56,13 @@ Transform plugin common parameters, please refer to [Transform Plugin](common-op
Use `NullRate` in transform's Dataset.
```bash
- transform {
- NullRate {
- fields = ["msg", "name"]
- rates = [10.0,3.45]
- save_to_table_name = "tmp"
- throw_exception_enable = true
- }
+transform {
+ NullRate {
+ fields = ["msg", "name"]
+ rates = [10.0,3.45]
+ save_to_table_name = "tmp"
+ throw_exception_enable = true
}
+}
```
+
diff --git a/pom.xml b/pom.xml
index 2913f0b8872..aa570d19765 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,8 +13,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
4.0.0
@@ -26,50 +25,12 @@
org.apache.seatunnel
seatunnel
- pom
${revision}
+ pom
SeaTunnel
-
- Production ready big data processing product based on Apache Spark and Apache Flink.
-
-
- https://github.com/apache/incubator-seatunnel
-
-
-
- The Apache License, Version 2.0
- https://www.apache.org/licenses/LICENSE-2.0.txt
-
-
-
-
- scm:git:https://github.com/apache/incubator-seatunnel.git
- scm:git:https://github.com/apache/incubator-seatunnel.git
- https://github.com/apache/incubator-seatunnel
- HEAD
-
-
-
- GitHub
- https://github.com/apache/incubator-seatunnel/issues
-
-
-
-
- SeaTunnel Developer List
- dev@seatunnel.apache.org
- dev-subscribe@seatunnel.apache.org
- dev-unsubscribe@seatunnel.apache.org
-
-
- SeaTunnel Commits List
- commits@seatunnel.apache.org
- commits-subscribe@seatunnel.apache.org
- commits-unsubscribe@seatunnel.apache.org
-
-
+ Production ready big data processing product based on Apache Spark and Apache Flink.
2.1.3-SNAPSHOT
@@ -148,8 +83,6 @@
false
2.22.2
2.22.2
- 3.1.2
- true
1.6.8
3.0.1
2.9.1
@@ -180,7 +113,6 @@
1.3.0
1.20
2.17.1
- 1.0.0
0.38.0
1.3.0
1.9.5
@@ -198,6 +130,8 @@
1.1.8.3
3.10.0
4.2.0
+ 2.23.0
+ 3.4.3
@@ -292,8 +226,8 @@
slf4j-api
- junit
junit
+ junit
@@ -447,17 +381,17 @@
scala-compile-first
- process-resources
compile
+ process-resources
scala-test-compile
- process-test-resources
testCompile
+ process-test-resources
@@ -486,8 +420,7 @@
${skipUT}
- ${project.build.directory}/jacoco.exec
-
+ ${project.build.directory}/jacoco.exec
**/*IT.java
@@ -548,14 +481,14 @@
- package
shade
+ package
-
+
@@ -569,79 +502,6 @@
${maven-assembly-plugin.version}
-
-
- org.apache.maven.plugins
- maven-checkstyle-plugin
- ${maven-checkstyle-plugin.version}
-
-
- ${maven.multiModuleProjectDirectory}/tools/checkstyle/checkStyle.xml
-
- UTF-8
- true
- true
- ${checkstyle.fails.on.error}
-
- ${project.build.sourceDirectory}
- ${project.build.testSourceDirectory}
-
-
- **/*.properties,
- **/*.sh,
- **/*.bat,
- **/*.yml,
- **/*.yaml,
- **/*.xml
-
-
- **/.asf.yaml,
- **/.github/**
-
-
-
-
-
-
- validate
- process-sources
-
- check
-
-
-
-
-
-
- org.scalastyle
- scalastyle-maven-plugin
- ${scalastyle-maven-plugin.version}
-
- false
- true
- false
- false
- ${basedir}/src/main/scala
- ${basedir}/src/test/scala
-
-
- ${maven.multiModuleProjectDirectory}/tools/checkstyle/scalastyle-config.xml
-
- ${project.build.directory}/target/scalastyle-output.xml
- UTF-8
- UTF-8
-
-
-
-
- check
-
-
-
-
-
-
-
org.apache.maven.plugins
maven-source-plugin
@@ -677,7 +537,6 @@
-
org.codehaus.mojo
build-helper-maven-plugin
@@ -713,17 +572,17 @@
flatten
- process-resources
flatten
+ process-resources
flatten.clean
- clean
clean
+ clean
@@ -770,20 +629,144 @@
- org.apache.maven.plugins
- maven-checkstyle-plugin
+ org.codehaus.mojo
+ license-maven-plugin
- org.scalastyle
- scalastyle-maven-plugin
+ com.diffplug.spotless
+ spotless-maven-plugin
+ ${spotless.version}
+
+
+ HEAD
+
+
+ tools/style/spotless_seatunnel_formatter.xml
+
+
+
+ tools/style/seatunnel.importorder
+
+
+ Remove wildcard imports
+ import\s+[^\*\s]+\*;(\r\n|\r|\n)
+ $1
+
+
+
+
+ **/*.scala
+ **/*.sc
+
+
+
+ ${spotless.scalafmt.version}
+ tools/style/seatunnel_scalafmt.conf
+
+ >
+
+
+
+
+ UTF-8
+ 4
+ true
+ false
+ true
+ true
+ false
+ false
+ custom_1
+ false
+ false
+
+
+ Leading blank line
+ project
+ project
+
+
+
+
+ **/*.md
+
+
+
+
+
+
+
+ check
+
+ compile
+
+
-
- org.codehaus.mojo
- license-maven-plugin
-
+ https://github.com/apache/incubator-seatunnel
+
+
+
+ The Apache License, Version 2.0
+ https://www.apache.org/licenses/LICENSE-2.0.txt
+
+
+
+
+
+ SeaTunnel Developer List
+ dev-subscribe@seatunnel.apache.org
+ dev-unsubscribe@seatunnel.apache.org
+ dev@seatunnel.apache.org
+
+
+ SeaTunnel Commits List
+ commits-subscribe@seatunnel.apache.org
+ commits-unsubscribe@seatunnel.apache.org
+ commits@seatunnel.apache.org
+
+
+
+
+ scm:git:https://github.com/apache/incubator-seatunnel.git
+ scm:git:https://github.com/apache/incubator-seatunnel.git
+ https://github.com/apache/incubator-seatunnel
+ HEAD
+
+
+
+ GitHub
+ https://github.com/apache/incubator-seatunnel/issues
+
+
+
+
+ all
+
+ true
+
+ release
+ false
+
+
+
+ seatunnel-examples
+ seatunnel-e2e
+
+
+
+ release
+
+
+ release
+ true
+
+
+
+
+
diff --git a/seatunnel-api/src/main/java/org/apache/seatunnel/api/configuration/util/Condition.java b/seatunnel-api/src/main/java/org/apache/seatunnel/api/configuration/util/Condition.java
index 74c08c1c706..d8f6a1fbf9d 100644
--- a/seatunnel-api/src/main/java/org/apache/seatunnel/api/configuration/util/Condition.java
+++ b/seatunnel-api/src/main/java/org/apache/seatunnel/api/configuration/util/Condition.java
@@ -22,6 +22,7 @@
import java.util.Objects;
public class Condition {
+
private final Option option;
private final T expectValue;
private Boolean and = null;
@@ -104,9 +105,9 @@ public boolean equals(Object obj) {
}
Condition> that = (Condition>) obj;
return Objects.equals(this.option, that.option)
- && Objects.equals(this.expectValue, that.expectValue)
- && Objects.equals(this.and, that.and)
- && Objects.equals(this.next, that.next);
+ && Objects.equals(this.expectValue, that.expectValue)
+ && Objects.equals(this.and, that.and)
+ && Objects.equals(this.next, that.next);
}
@Override
@@ -121,10 +122,10 @@ public String toString() {
boolean bracket = false;
do {
builder.append("'")
- .append(cur.option.key())
- // TODO: support another condition
- .append("' == ")
- .append(cur.expectValue);
+ .append(cur.option.key())
+ // TODO: support another condition
+ .append("' == ")
+ .append(cur.expectValue);
if (bracket) {
builder = new StringBuilder(String.format("(%s)", builder));
bracket = false;
diff --git a/seatunnel-connectors/seatunnel-connectors-spark/seatunnel-connector-spark-console/src/main/scala/org/apache/seatunnel/spark/console/sink/Console.scala b/seatunnel-connectors/seatunnel-connectors-spark/seatunnel-connector-spark-console/src/main/scala/org/apache/seatunnel/spark/console/sink/Console.scala
index 50ae94d438b..5a1e874b0e0 100644
--- a/seatunnel-connectors/seatunnel-connectors-spark/seatunnel-connector-spark-console/src/main/scala/org/apache/seatunnel/spark/console/sink/Console.scala
+++ b/seatunnel-connectors/seatunnel-connectors-spark/seatunnel-connector-spark-console/src/main/scala/org/apache/seatunnel/spark/console/sink/Console.scala
@@ -18,7 +18,15 @@ package org.apache.seatunnel.spark.console.sink
import org.apache.seatunnel.common.config.CheckResult
import org.apache.seatunnel.shade.com.typesafe.config.ConfigFactory
-import org.apache.seatunnel.spark.console.Config.{LIMIT, SERIALIZER, PLAIN, JSON, SCHEMA, DEFAULT_SERIALIZER, DEFAULT_LIMIT}
+import org.apache.seatunnel.spark.console.Config.{
+ LIMIT,
+ SERIALIZER,
+ PLAIN,
+ JSON,
+ SCHEMA,
+ DEFAULT_SERIALIZER,
+ DEFAULT_LIMIT
+}
import org.apache.seatunnel.spark.SparkEnvironment
import org.apache.seatunnel.spark.batch.SparkBatchSink
import org.apache.spark.sql.{Dataset, Row}
@@ -53,10 +61,15 @@ class Console extends SparkBatchSink {
}
override def checkConfig(): CheckResult = {
- if (!config.hasPath(LIMIT) || (config.hasPath(LIMIT) && config.getInt(LIMIT) >= -1)) {
+ if (
+ !config
+ .hasPath(LIMIT) || (config.hasPath(LIMIT) && config.getInt(LIMIT) >= -1)
+ ) {
CheckResult.success()
} else {
- CheckResult.error("Please specify [" + LIMIT + "] as Number[-1, " + Int.MaxValue + "]")
+ CheckResult.error(
+ "Please specify [" + LIMIT + "] as Number[-1, " + Int.MaxValue + "]"
+ )
}
}
@@ -65,7 +78,8 @@ class Console extends SparkBatchSink {
Map(
LIMIT -> DEFAULT_LIMIT,
SERIALIZER -> DEFAULT_SERIALIZER // plain | json
- ))
+ )
+ )
config = config.withFallback(defaultConfig)
}
diff --git a/seatunnel-connectors/seatunnel-connectors-spark/seatunnel-connector-spark-doris/src/main/scala/org/apache/seatunnel/spark/doris/sink/Doris.scala b/seatunnel-connectors/seatunnel-connectors-spark/seatunnel-connector-spark-doris/src/main/scala/org/apache/seatunnel/spark/doris/sink/Doris.scala
index f74df92524b..0091f0666e0 100644
--- a/seatunnel-connectors/seatunnel-connectors-spark/seatunnel-connector-spark-doris/src/main/scala/org/apache/seatunnel/spark/doris/sink/Doris.scala
+++ b/seatunnel-connectors/seatunnel-connectors-spark/seatunnel-connector-spark-doris/src/main/scala/org/apache/seatunnel/spark/doris/sink/Doris.scala
@@ -16,12 +16,12 @@
*/
package org.apache.seatunnel.spark.doris.sink
-
-import org.apache.seatunnel.common.config.CheckConfigUtil.checkAllExists
import org.apache.seatunnel.common.config.{CheckResult, TypesafeConfigUtils}
+import org.apache.seatunnel.common.config.CheckConfigUtil.checkAllExists
import org.apache.seatunnel.spark.SparkEnvironment
import org.apache.seatunnel.spark.batch.SparkBatchSink
import org.apache.seatunnel.spark.doris.sink.Config._
+
import org.apache.spark.sql.{Dataset, Row}
import scala.collection.mutable
@@ -45,31 +45,34 @@ class Doris extends SparkBatchSink with Serializable {
val sparkSession = env.getSparkSession
import sparkSession.implicits._
val fields = data.schema.fields
- val dataFrame = data.map(row => {
- val builder = new StringBuilder
- fields.foreach(f => {
- var filedValue = row.getAs[Any](f.name)
- if (filedValue == null) {
- filedValue = NULL_VALUE
- }
- builder.append(filedValue).append(column_separator)
+ val dataFrame = data.map(
+ row => {
+ val builder = new StringBuilder
+ fields.foreach(
+ f => {
+ var filedValue = row.getAs[Any](f.name)
+ if (filedValue == null) {
+ filedValue = NULL_VALUE
+ }
+ builder.append(filedValue).append(column_separator)
+ })
+ builder.substring(0, builder.length - 1)
})
- builder.substring(0, builder.length - 1)
- })
- dataFrame.foreachPartition { partition =>
- var count: Int = 0
- val buffer = new ListBuffer[String]
- val dorisUtil = new DorisUtil(propertiesMap.toMap, apiUrl, user, password)
- for (message <- partition) {
- count += 1
- buffer += message
- if (count > batch_size) {
- dorisUtil.saveMessages(buffer.mkString("\n"))
- buffer.clear()
- count = 0
+ dataFrame.foreachPartition {
+ partition =>
+ var count: Int = 0
+ val buffer = new ListBuffer[String]
+ val dorisUtil = new DorisUtil(propertiesMap.toMap, apiUrl, user, password)
+ for (message <- partition) {
+ count += 1
+ buffer += message
+ if (count > batch_size) {
+ dorisUtil.saveMessages(buffer.mkString("\n"))
+ buffer.clear()
+ count = 0
+ }
}
- }
- dorisUtil.saveMessages(buffer.mkString("\n"))
+ dorisUtil.saveMessages(buffer.mkString("\n"))
}
}
@@ -81,7 +84,8 @@ class Doris extends SparkBatchSink with Serializable {
apiUrl =
s"http://${config.getString(HOST)}/api/${config.getString(DATABASE)}/${config.getString(TABLE_NAME)}/_stream_load"
if (TypesafeConfigUtils.hasSubConfig(config, ARGS_PREFIX)) {
- val properties = TypesafeConfigUtils.extractSubConfig(config, ARGS_PREFIX, true)
+ val properties =
+ TypesafeConfigUtils.extractSubConfig(config, ARGS_PREFIX, true)
val iterator = properties.entrySet().iterator()
while (iterator.hasNext) {
val map = iterator.next()
@@ -99,7 +103,8 @@ class Doris extends SparkBatchSink with Serializable {
/**
* Return the plugin name, this is used in seatunnel conf DSL.
*
- * @return plugin name.
+ * @return
+ * plugin name.
*/
override def getPluginName: String = "Doris"
}
diff --git a/tools/checkstyle/checkStyle.xml b/tools/checkstyle/checkStyle.xml
deleted file mode 100755
index 82c33518969..00000000000
--- a/tools/checkstyle/checkStyle.xml
+++ /dev/null
@@ -1,547 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tools/checkstyle/scalastyle-config.xml b/tools/checkstyle/scalastyle-config.xml
deleted file mode 100644
index b81d4421dc4..00000000000
--- a/tools/checkstyle/scalastyle-config.xml
+++ /dev/null
@@ -1,292 +0,0 @@
-
-
-
-
- Scalastyle standard configuration
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ^[a-z][A-Za-z0-9]*$
-
-
-
-
-
-
-
-
-
-
-
- ^[a-z][A-Za-z0-9]*$
- ^$
-
-
-
-
-
- 15
-
-
-
-
-
-
-
-
-
-
-
- Illegal import of sun._ or java.awt._
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- true
- true
-
-
-
-
-
-
-
-
-
-
-
-
- \)\{
-
-
-
-
-
-
-
- mutable\.SynchronizedBuffer
-
-
-
-
-
-
-
- Await\.result
-
-
-
-
-
-
-
- Await\.ready
-
-
-
-
-
-
-
- FileSystem.get\([a-zA-Z_$][a-zA-Z_$0-9]*\)
-
-
-
-
-
-
-
- org\.apache\.commons\.lang\.
-
- Use Commons Lang 3 classes (package org.apache.commons.lang3.*) instead
- of Commons Lang 2 (package org.apache.commons.lang.*)
-
-
-
-
-
- ^println$
-
-
-
-
-
-
-
-
-
-
- ^.*$
- false
-
-
-
-
-
-
- 800
-
-
-
-
-
-
- 50
-
-
-
-
-
-
- 80
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- LPAREN
-
-
-
-
-
- ARROW, EQUALS, ELSE, TRY, CATCH, FINALLY, LARROW, RARROW
-
-
-
-
-
- ARROW, EQUALS, COMMA, COLON, IF, ELSE, DO, WHILE, FOR, MATCH, TRY, CATCH, FINALLY,
- LARROW, RARROW
-
-
-
-
-
-
- COLON, COMMA, RPAREN
-
-
-
-
-
-
\ No newline at end of file
diff --git a/tools/style/pre-commit b/tools/style/pre-commit
new file mode 100644
index 00000000000..89ef99f755c
--- /dev/null
+++ b/tools/style/pre-commit
@@ -0,0 +1,24 @@
+#!/bin/sh
+#
+# 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.
+#
+
+# A hook script to automatically fix code style and formatting errors with spotless
+if ./mvnw spotless:check; then
+ exit 0
+fi
+./mvnw spotless:apply
+exit 1
diff --git a/tools/style/seatunnel.importorder b/tools/style/seatunnel.importorder
new file mode 100644
index 00000000000..5e531b841ee
--- /dev/null
+++ b/tools/style/seatunnel.importorder
@@ -0,0 +1,23 @@
+#
+# 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.
+#
+#Organize Import Order
+0=org.apache.seatunnel
+1=org.apache
+2=java
+3=javax
+4=org
+5=com
\ No newline at end of file
diff --git a/tools/style/seatunnel_scalafmt.conf b/tools/style/seatunnel_scalafmt.conf
new file mode 100644
index 00000000000..ec2c474e7d6
--- /dev/null
+++ b/tools/style/seatunnel_scalafmt.conf
@@ -0,0 +1,85 @@
+#
+# 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.
+#
+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.seatunnel\\..*"],
+ [".*"],
+ ["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"
\ No newline at end of file
diff --git a/tools/style/spotless_seatunnel_formatter.xml b/tools/style/spotless_seatunnel_formatter.xml
new file mode 100644
index 00000000000..aa30e4434e3
--- /dev/null
+++ b/tools/style/spotless_seatunnel_formatter.xml
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+