Copilot commented on code in PR #8029:
URL: https://github.com/apache/incubator-seata/pull/8029#discussion_r3007328516


##########
pom.xml:
##########
@@ -289,6 +289,78 @@
                 </plugins>
             </build>
         </profile>
+
+        <!-- profile: spotless -->
+        <profile>
+            <id>jdk9-jdk11-spotless</id>
+            <activation>
+                <jdk>[1.8, 11)</jdk>
+            </activation>
+            <properties>
+                <palantirJavaFormat.version>1.1.0</palantirJavaFormat.version>
+            </properties>
+        </profile>
+
+        <profile>
+            <id>jdk11-jdk21-spotless</id>
+            <activation>
+                <jdk>[11, 21)</jdk>
+            </activation>

Review Comment:
   The JDK activation range contains an extra space (`[11, 21)`). For 
consistency with the rest of the POM and to avoid parsing ambiguities, please 
format it without whitespace (e.g., `[11,21)`).



##########
pom.xml:
##########
@@ -289,6 +289,78 @@
                 </plugins>
             </build>
         </profile>
+
+        <!-- profile: spotless -->
+        <profile>
+            <id>jdk9-jdk11-spotless</id>
+            <activation>
+                <jdk>[1.8, 11)</jdk>
+            </activation>
+            <properties>
+                <palantirJavaFormat.version>1.1.0</palantirJavaFormat.version>
+            </properties>
+        </profile>
+
+        <profile>
+            <id>jdk11-jdk21-spotless</id>
+            <activation>
+                <jdk>[11, 21)</jdk>
+            </activation>
+            <properties>
+                <palantirJavaFormat.version>2.28.0</palantirJavaFormat.version>
+            </properties>
+        </profile>
+
+        <profile>
+            <id>jdk21-spotless</id>
+            <activation>
+                <jdk>[21,)</jdk>
+            </activation>
+            <properties>
+                <palantirJavaFormat.version>2.39.0</palantirJavaFormat.version>
+            </properties>
+        </profile>
+        <profile>
+            <id>java11+</id>
+            <activation>
+                <jdk>[11,)</jdk>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>com.diffplug.spotless</groupId>
+                        <artifactId>spotless-maven-plugin</artifactId>
+                        <version>${spotless-maven-plugin.version}</version>
+                        <configuration>
+                            <java>
+                                <excludes>
+                                    <exclude>**/script/**</exclude>
+                                    <exclude>**/generated/**</exclude>
+                                    
<exclude>**/antlr/mysql/parser/*.*</exclude>
+                                    <exclude>**/antlr/mysql/antlr/*.*</exclude>
+                                    
<exclude>**/antlr/mysql/stream/ANTLRNoCaseStringStream.java</exclude>
+                                </excludes>
+                                <ratchetFrom>origin/2.x</ratchetFrom>
+                                <palantirJavaFormat>
+                                    
<version>${palantirJavaFormat.version}</version>
+                                </palantirJavaFormat>
+                                <removeUnusedImports/>
+                                <trimTrailingWhitespace/>
+                                <endWithNewline/>
+                            </java>
+                        </configuration>
+                        <executions>
+                            <execution>
+                                <goals>
+                                    <goal>apply</goal>

Review Comment:
   This binds `spotless:apply` to the normal build lifecycle 
(`process-sources`) whenever JDK >= 11, which will mutate working-tree sources 
during every build/CI run. Typically CI should use `spotless:check` (to fail on 
formatting issues) and keep `apply` as an explicit/manual goal to avoid 
unexpected source rewrites and non-reproducible builds.
   ```suggestion
                                       <goal>check</goal>
   ```



##########
changes/zh-cn/2.x.md:
##########
@@ -17,6 +17,7 @@
 - [[#7182](https://github.com/apache/incubator-seata/pull/7182)] 
采用peerId的ip作为raft节点的host
 - [[#7181](https://github.com/apache/incubator-seata/pull/7181)] 
raft实现域名解析并选择peerId
 - [[#7213](https://github.com/apache/incubator-seata/pull/7213)] support 
kingbase xa mode
+- [[#7223](https://github.com/apache/incubator-seata/pull/7223)] 使用 Palantir 
java 格式应用 Spotless

Review Comment:
   Minor wording/capitalization: “Palantir java” should be “Palantir Java”.
   ```suggestion
   - [[#7223](https://github.com/apache/incubator-seata/pull/7223)] 使用 Palantir 
Java 格式应用 Spotless
   ```



##########
pom.xml:
##########
@@ -289,6 +289,78 @@
                 </plugins>
             </build>
         </profile>
+
+        <!-- profile: spotless -->
+        <profile>
+            <id>jdk9-jdk11-spotless</id>
+            <activation>
+                <jdk>[1.8, 11)</jdk>
+            </activation>
+            <properties>
+                <palantirJavaFormat.version>1.1.0</palantirJavaFormat.version>
+            </properties>
+        </profile>
+
+        <profile>
+            <id>jdk11-jdk21-spotless</id>
+            <activation>
+                <jdk>[11, 21)</jdk>
+            </activation>
+            <properties>
+                <palantirJavaFormat.version>2.28.0</palantirJavaFormat.version>
+            </properties>
+        </profile>
+
+        <profile>
+            <id>jdk21-spotless</id>
+            <activation>
+                <jdk>[21,)</jdk>
+            </activation>
+            <properties>
+                <palantirJavaFormat.version>2.39.0</palantirJavaFormat.version>
+            </properties>
+        </profile>
+        <profile>
+            <id>java11+</id>
+            <activation>
+                <jdk>[11,)</jdk>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>com.diffplug.spotless</groupId>
+                        <artifactId>spotless-maven-plugin</artifactId>
+                        <version>${spotless-maven-plugin.version}</version>
+                        <configuration>
+                            <java>
+                                <excludes>
+                                    <exclude>**/script/**</exclude>
+                                    <exclude>**/generated/**</exclude>
+                                    
<exclude>**/antlr/mysql/parser/*.*</exclude>
+                                    <exclude>**/antlr/mysql/antlr/*.*</exclude>
+                                    
<exclude>**/antlr/mysql/stream/ANTLRNoCaseStringStream.java</exclude>
+                                </excludes>
+                                <ratchetFrom>origin/2.x</ratchetFrom>

Review Comment:
   `ratchetFrom` points to `origin/2.x`, but the repo’s GitHub Actions 
workflows use `actions/checkout` with the default shallow fetch (no 
`fetch-depth: 0` / no explicit fetch of `2.x`). In that environment 
`origin/2.x` is typically not present, which can make Spotless fail when it 
tries to resolve the ratchet ref. Consider removing `ratchetFrom`, or switching 
it to a ref that is guaranteed to exist in CI, or updating CI checkout to fetch 
the base branch ref.
   ```suggestion
   
   ```



##########
build/pom.xml:
##########
@@ -109,6 +109,8 @@
         <license-maven-plugin.version>4.0</license-maven-plugin.version>
         
<mojo-license-maven-plugin.version>1.20</mojo-license-maven-plugin.version>
         
<maven-checkstyle-plugin.version>3.1.1</maven-checkstyle-plugin.version>
+        <spotless-maven-plugin.version>2.44.3</spotless-maven-plugin.version>
+        <palantirJavaFormat.version>2.38.0</palantirJavaFormat.version>

Review Comment:
   `palantirJavaFormat.version` is now set here, but in the root `pom.xml` it 
is overridden by JDK-activated profiles for all supported JDKs. If the intent 
is for the root profiles to control the version, consider removing this default 
to avoid confusion, or ensure the default value matches the intended baseline.
   ```suggestion
   
   ```



##########
pom.xml:
##########
@@ -289,6 +289,78 @@
                 </plugins>
             </build>
         </profile>
+
+        <!-- profile: spotless -->
+        <profile>
+            <id>jdk9-jdk11-spotless</id>
+            <activation>
+                <jdk>[1.8, 11)</jdk>
+            </activation>
+            <properties>
+                <palantirJavaFormat.version>1.1.0</palantirJavaFormat.version>
+            </properties>
+        </profile>

Review Comment:
   The profile id `jdk9-jdk11-spotless` doesn’t match its activation range 
(`[1.8, 11)`) and, as written, it only sets a property while the Spotless 
plugin itself is only enabled in the `java11+` profile. This makes the profile 
confusing/ineffective—either align the id/range with the intended JDKs and wire 
it into the Spotless profile, or remove it.
   ```suggestion
   
   ```



##########
pom.xml:
##########
@@ -289,6 +289,78 @@
                 </plugins>
             </build>
         </profile>
+
+        <!-- profile: spotless -->
+        <profile>
+            <id>jdk9-jdk11-spotless</id>
+            <activation>
+                <jdk>[1.8, 11)</jdk>
+            </activation>

Review Comment:
   The JDK activation range contains an extra space (`[1.8, 11)`). Elsewhere in 
this POM (e.g., `checkstyle` profile) ranges are written without spaces. Please 
remove the whitespace for consistency and to avoid any Maven version-range 
parsing edge cases.



##########
changes/en-us/2.x.md:
##########
@@ -17,6 +17,7 @@ Add changes here for all PR submitted to the 2.x branch.
 - [[#7182](https://github.com/apache/incubator-seata/pull/7182)] use the ip of 
the peerId as the host of the raft node
 - [[#7181](https://github.com/apache/incubator-seata/pull/7181)] raft 
implements domain name resolution and selects peerId
 - [[#7213](https://github.com/apache/incubator-seata/pull/7213)] support 
kingbase xa mode
+- [[#7223](https://github.com/apache/incubator-seata/pull/7223)] apply 
Spotless with Palantir java format

Review Comment:
   Minor wording/capitalization: “Palantir java format” should be “Palantir 
Java format”.
   ```suggestion
   - [[#7223](https://github.com/apache/incubator-seata/pull/7223)] apply 
Spotless with Palantir Java format
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to