Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CONTRIBUTING-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ Spring AI Alibaba 作为 Spring AI 的实现之一,在代码规范方面直接

为了减少一些不必要的代码风格问题,Spring AI Alibaba 提供了本地 Checkstyle 检查功能。可以在项目根目录下执行 `mvn checkstyle:check` 命令来检查代码风格是否符合规范。

### 删除未使用的导入

为了确保代码的整洁,请删除 Java 文件中未使用的导入。可以通过执行 `mvn spotless:apply` 命令来自动删除未使用的导入。

### 提交最新代码

在编码完成之后,需要基于 pr 规范`[lint-pr-title.yml](.github/workflows/lint-pr-title.yml)`对提交信息进行 format & check,确保提交信息符合规范。
Expand Down
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ After completing development in your local BOE environment, it's strongly recomm

To reduce unnecessary code style issues, Spring AI Alibaba provides a local Checkstyle check feature. You can run `mvn checkstyle:check` in the project's root directory to verify if your code style complies with the standards.

### Remove Unused Imports

To ensure code cleanliness, please remove any unused imports in your Java files. You can do this by using the `mvn spotless:apply` command, which will automatically remove unused imports from your code.

### Commit the Latest Code

After completing your coding, you need to format and verify your commit messages according to the PR specification in `[lint-pr-title.yml](.github/workflows/lint-pr-title.yml)` to ensure they comply with the guidelines.
Expand Down
20 changes: 20 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@
<maven-checkstyle-plugin.failsOnError>true</maven-checkstyle-plugin.failsOnError>
<maven-checkstyle-plugin.failOnViolation>true</maven-checkstyle-plugin.failOnViolation>
<puppycrawl-tools-checkstyle.version>9.3</puppycrawl-tools-checkstyle.version>
<spotless.version>2.29.0</spotless.version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -344,6 +345,25 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>2.29.0</version>
<configuration>
<java>
<removeUnusedImports></removeUnusedImports>
</java>
</configuration>
<executions>
<execution>
<id>spotless-apply</id>
<goals>
<goal>apply</goal>
</goals>
<phase>process-sources</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
Expand Down
19 changes: 19 additions & 0 deletions spring-ai-alibaba-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,25 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>2.29.0</version>
<configuration>
<java>
<removeUnusedImports></removeUnusedImports>
</java>
</configuration>
<executions>
<execution>
<id>spotless-apply</id>
<goals>
<goal>apply</goal>
</goals>
<phase>process-sources</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
Expand Down
19 changes: 19 additions & 0 deletions spring-ai-alibaba-deepresearch/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,25 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>2.29.0</version>
<configuration>
<java>
<removeUnusedImports></removeUnusedImports>
</java>
</configuration>
<executions>
<execution>
<id>spotless-apply</id>
<goals>
<goal>apply</goal>
</goals>
<phase>process-sources</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
19 changes: 19 additions & 0 deletions spring-ai-alibaba-jmanus/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,25 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>2.29.0</version>
<configuration>
<java>
<removeUnusedImports></removeUnusedImports>
</java>
</configuration>
<executions>
<execution>
<id>spotless-apply</id>
<goals>
<goal>apply</goal>
</goals>
<phase>process-sources</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
5 changes: 5 additions & 0 deletions tools/make/java.mk
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ format-check: ## Format Check the code
@$(LOG_TARGET)
mvn spring-javaformat:validate

.PHONY: spotless-apply
spotless-apply: ## Run spotless and apply changes
@$(LOG_TARGET)
mvn spotless:apply

.PHONY: checkstyle-check
checkstyle-check: ## Checkstyle Check the code and output to target/checkstyle-report.xml
@$(LOG_TARGET)
Expand Down
Loading