lidavidm commented on code in PR #40835:
URL: https://github.com/apache/arrow/pull/40835#discussion_r1542808315
##########
java/algorithm/pom.xml:
##########
@@ -50,4 +55,68 @@
<build>
</build>
+
+ <profiles>
+ <profile>
+ <id>spotless-jdk11+</id>
+ <activation>
+ <jdk>[11,]</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.diffplug.spotless</groupId>
+ <artifactId>spotless-maven-plugin</artifactId>
+ <version>${spotless.version.jdk11}</version>
+ <configuration>
+ <formats>
+ <format>
+ <!-- configure license for xml files -->
+ <includes>
+ <include>pom.xml</include>
+ </includes>
+ <licenseHeader>
+
<file>${maven.multiModuleProjectDirectory}/java/spotless/asf-xml.license</file>
+ <delimiter>(<configuration|<project)</delimiter>
+ </licenseHeader>
+ </format>
+ <format>
+ <!-- configure license for java files -->
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ <licenseHeader>
+
<file>${maven.multiModuleProjectDirectory}/java/spotless/asf-java.license</file>
+ <delimiter>package</delimiter>
+ </licenseHeader>
+</format>
+ </formats>
Review Comment:
Yes, if there's a pre-commit plugin for XML that would be nice.
##########
docs/source/developers/java/development.rst:
##########
@@ -110,9 +110,66 @@ integration tests, you would do:
Code Style
==========
-Code style is enforced with Checkstyle. The configuration is located at
`checkstyle`_.
+The current Java code styles are configured as follows:
+
+- Indent: Tabs & spaces (2 spaces per tab)
+- Google Java Format: Reformats Java source code to comply with `Google Java
Style`_.
+- Configure license headers for Java & XML files
+
+Java code style is checked by `Spotless`_ during the build, and the continuous
integration build will verify
+that changes adhere to the style guide.
+
+.. code-block:: xml
+
+ <java>
+ <indent>
+ ...
+ </indent>
+ <googleJavaFormat/>
+ <licenseHeader>
+ ...
+ </licenseHeader>
+ </java>
+ <pom>
+ <indent>
+ ...
+ </indent>
+ <sortPom>
+ ...
+ </sortPom>
+ </pom>
+
+Automatically fixing code style issues
+--------------------------------------
+
+- You can also just check the style without building the project with `mvn
spotless:check`.
+- The Java code style can be corrected from the command line by using the
following commands: `mvn spotless:apply`.
+
+.. code-block:: bash
+
+ user@machine repo % mvn spotless:check
Review Comment:
Was this copied from their docs? Can we just provide our own example or omit
this?
##########
docs/source/developers/java/development.rst:
##########
@@ -110,9 +110,66 @@ integration tests, you would do:
Code Style
==========
-Code style is enforced with Checkstyle. The configuration is located at
`checkstyle`_.
+The current Java code styles are configured as follows:
+
+- Indent: Tabs & spaces (2 spaces per tab)
+- Google Java Format: Reformats Java source code to comply with `Google Java
Style`_.
+- Configure license headers for Java & XML files
+
+Java code style is checked by `Spotless`_ during the build, and the continuous
integration build will verify
+that changes adhere to the style guide.
+
+.. code-block:: xml
Review Comment:
I don't see what this code block is for?
##########
java/algorithm/pom.xml:
##########
@@ -50,4 +55,68 @@
<build>
</build>
+
+ <profiles>
+ <profile>
+ <id>spotless-jdk11+</id>
Review Comment:
I don't want to have two separate versions of the formatter. Only build/test
needs to work on JDK8.
--
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]