Skip to content

Commit

Permalink
[Feature][style] Add spotless maven plugin for automatic style fix. (a…
Browse files Browse the repository at this point in the history
…pache#11272)

* [Feature][style] Add spotless maven plugin for automatic style fix (apache#10963)

* Fix spotless ratchet configuration

* Remove license-check and decrease line length threshold value

* Update related docs

* Remove checkstyle and add pre-commit hook

* Test updated pre-commit hook

* Replace checkstyle with spotless in CI

* Remove reviewdog
  • Loading branch information
EricGao888 authored Aug 6, 2022
1 parent bf5f7a8 commit 6a02870
Show file tree
Hide file tree
Showing 12 changed files with 543 additions and 776 deletions.
1 change: 0 additions & 1 deletion .github/actions/reviewdog-setup
Submodule reviewdog-setup deleted from c2fa3e
17 changes: 1 addition & 16 deletions .github/actions/sanity-check/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,5 @@ runs:
- name: Check License Header
uses: apache/skywalking-eyes@30367d8286e324d5efc58de4c70c37ea3648306d

- uses: ./.github/actions/reviewdog-setup
with:
reviewdog_version: v0.10.2

- shell: bash
run: ./mvnw -B -q checkstyle:checkstyle-aggregate

- shell: bash
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ inputs.token }}
run: |
if [[ -n "${{ inputs.token }}" ]]; then
reviewdog -f=checkstyle \
-reporter="github-pr-review" \
-filter-mode="added" \
-fail-on-error="true" < target/checkstyle-result.xml
fi
run: ./mvnw spotless:check
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,3 @@
[submodule ".github/actions/translate-on-issue"]
path = .github/actions/translate-on-issue
url = https://github.com/xingchun-chen/translation-helper
[submodule ".github/actions/reviewdog-setup"]
path = .github/actions/reviewdog-setup
url = https://github.com/reviewdog/action-setup
1 change: 0 additions & 1 deletion .licenserc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ header:
- '**/NOTICE'
- '**/node_modules/**'
- '.github/actions/comment-on-issue/**'
- '.github/actions/reviewdog-setup/**'
- '.github/actions/translate-on-issue/**'
- '**/.gitkeep'

Expand Down
16 changes: 15 additions & 1 deletion docs/docs/en/contribute/development-environment-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,28 @@ cd dolphinscheduler
git clone [email protected]:apache/dolphinscheduler.git
```

### compile source code
### Compile Source Code

Supporting system:
* MacOS
* Liunx

Run `mvn clean install -Prelease -Dmaven.test.skip=true`

### Code Style

DolphinScheduler 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 `/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.

## Docker image build

DolphinScheduler will release new Docker images after it released, you could find them in [Docker Hub](https://hub.docker.com/search?q=DolphinScheduler).
Expand Down
13 changes: 13 additions & 0 deletions docs/docs/zh/contribute/development-environment-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,19 @@ git clone [email protected]:apache/dolphinscheduler.git

运行 `mvn clean install -Prelease -Dmaven.test.skip=true`


### 代码风格

DolphinScheduler使用`Spotless`检查并修复代码风格和格式问题。
您可以执行如下的命令,`Spotless`将会为您自动检查并修复代码风格和格式问题。

```shell
./mvnw spotless:apply
```

您可将`/style/pre-commit`目录下的`pre-commit hook`文件拷贝到您的`.git/hooks/`
目录下,这样您每次使用`git commit`命令时,`Spotless`将会自动为您修复代码风格和格式问题。

## Docker镜像构建

DolphinScheduler 每次发版都会同时发布 Docker 镜像,你可以在 [Docker Hub](https://hub.docker.com/search?q=DolphinScheduler) 中找到这些镜像
Expand Down
32 changes: 0 additions & 32 deletions dolphinscheduler-api-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -138,38 +138,6 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${checkstyle.version}</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>8.45</version>
</dependency>
</dependencies>
<configuration>
<consoleOutput>true</consoleOutput>
<encoding>UTF-8</encoding>
<configLocation>../style/checkstyle.xml</configLocation>
<failOnViolation>true</failOnViolation>
<violationSeverity>warning</violationSeverity>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
<sourceDirectories>
<sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
</sourceDirectories>
<excludes>**\/generated-sources\/</excludes>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,23 @@

package org.apache.dolphinscheduler.plugin.task.jupyter;


import org.apache.dolphinscheduler.spi.utils.JSONUtils;
import org.apache.dolphinscheduler.spi.utils.PropertyUtils;
import org.apache.dolphinscheduler.spi.utils.StringUtils;
import org.apache.dolphinscheduler.plugin.task.api.parser.ParamUtils;
import org.apache.dolphinscheduler.plugin.task.api.parser.ParameterUtils;
import org.apache.dolphinscheduler.plugin.task.api.AbstractTaskExecutor;
import org.apache.dolphinscheduler.plugin.task.api.ShellCommandExecutor;
import org.apache.dolphinscheduler.plugin.task.api.TaskConstants;

import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext;
import org.apache.dolphinscheduler.plugin.task.api.model.Property;
import org.apache.dolphinscheduler.plugin.task.api.model.TaskResponse;
import org.apache.dolphinscheduler.plugin.task.api.parameters.AbstractParameters;
import org.apache.dolphinscheduler.plugin.task.api.parser.ParamUtils;
import org.apache.dolphinscheduler.plugin.task.api.parser.ParameterUtils;
import org.apache.dolphinscheduler.plugin.task.api.utils.MapUtils;
import org.apache.dolphinscheduler.spi.utils.DateUtils;
import org.apache.dolphinscheduler.spi.utils.JSONUtils;
import org.apache.dolphinscheduler.spi.utils.PropertyUtils;
import org.apache.dolphinscheduler.spi.utils.StringUtils;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -152,7 +150,6 @@ protected String buildCommand() throws IOException {
return command;
}


/**
* build jupyter parameterization
*
Expand Down
Loading

0 comments on commit 6a02870

Please sign in to comment.