This is an automated email from the ASF dual-hosted git repository. tallison pushed a commit to branch branch_3x in repository https://gitbox.apache.org/repos/asf/tika.git
commit 63b8019fc5e852b1e903e555ec3a2aea7fa6cfbd Author: tallison <[email protected]> AuthorDate: Wed Dec 3 13:21:47 2025 -0500 Add spotless for license headers and imports2 --- .github/workflows/branch_3x-jdk11-build.yml | 2 +- .github/workflows/branch_3x-jdk17-build.yml | 2 +- .github/workflows/branch_3x-jdk21-build.yml | 2 +- .github/workflows/branch_3x-jdk23-build.yml | 2 +- .../org/apache/tika/parser/RenderingParser.java | 3 +- .../apache/tika/renderer/CompositeRenderer.java | 3 +- .../org/apache/tika/sax/SafeContentHandler.java | 5 -- .../apache/tika/fuzzing}/TestFuzzingCLI.java | 2 +- .../apache/tika/fuzzing}/TestTransformer.java | 1 + tika-parent/checkstyle.xml | 28 +---------- .../license-header.txt | 10 +--- tika-parent/pom.xml | 58 +++++++++++++++++++++- .../pipesiterator/csv}/TestCSVPipesIterator.java | 1 + 13 files changed, 69 insertions(+), 50 deletions(-) diff --git a/.github/workflows/branch_3x-jdk11-build.yml b/.github/workflows/branch_3x-jdk11-build.yml index 118ceef9c..4230c558c 100644 --- a/.github/workflows/branch_3x-jdk11-build.yml +++ b/.github/workflows/branch_3x-jdk11-build.yml @@ -37,4 +37,4 @@ jobs: with: java-version: ${{ matrix.java }} - name: Build with Maven - run: mvn clean test install javadoc:aggregate + run: mvn clean test install javadoc:aggregate -Pci diff --git a/.github/workflows/branch_3x-jdk17-build.yml b/.github/workflows/branch_3x-jdk17-build.yml index 097e7c5a5..1aabb1655 100644 --- a/.github/workflows/branch_3x-jdk17-build.yml +++ b/.github/workflows/branch_3x-jdk17-build.yml @@ -35,4 +35,4 @@ jobs: with: java-version: ${{ matrix.java }} - name: Build with Maven - run: mvn clean test install javadoc:aggregate + run: mvn clean test install javadoc:aggregate -Pci diff --git a/.github/workflows/branch_3x-jdk21-build.yml b/.github/workflows/branch_3x-jdk21-build.yml index 22cd5a423..bedbcfcfa 100644 --- a/.github/workflows/branch_3x-jdk21-build.yml +++ b/.github/workflows/branch_3x-jdk21-build.yml @@ -35,4 +35,4 @@ jobs: with: java-version: ${{ matrix.java }} - name: Build with Maven - run: mvn clean test install javadoc:aggregate + run: mvn clean test install javadoc:aggregate -Pci diff --git a/.github/workflows/branch_3x-jdk23-build.yml b/.github/workflows/branch_3x-jdk23-build.yml index a7b0666f9..6de1e6d87 100644 --- a/.github/workflows/branch_3x-jdk23-build.yml +++ b/.github/workflows/branch_3x-jdk23-build.yml @@ -35,4 +35,4 @@ jobs: with: java-version: ${{ matrix.java }} - name: Build with Maven - run: mvn clean test install javadoc:aggregate + run: mvn clean test install javadoc:aggregate -Pci diff --git a/tika-core/src/main/java/org/apache/tika/parser/RenderingParser.java b/tika-core/src/main/java/org/apache/tika/parser/RenderingParser.java index 0daae6be1..c64bef7d7 100644 --- a/tika-core/src/main/java/org/apache/tika/parser/RenderingParser.java +++ b/tika-core/src/main/java/org/apache/tika/parser/RenderingParser.java @@ -13,7 +13,8 @@ * 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. - */package org.apache.tika.parser; + */ +package org.apache.tika.parser; import org.apache.tika.renderer.Renderer; diff --git a/tika-core/src/main/java/org/apache/tika/renderer/CompositeRenderer.java b/tika-core/src/main/java/org/apache/tika/renderer/CompositeRenderer.java index a98d39c97..98c0eaaa4 100644 --- a/tika-core/src/main/java/org/apache/tika/renderer/CompositeRenderer.java +++ b/tika-core/src/main/java/org/apache/tika/renderer/CompositeRenderer.java @@ -13,7 +13,8 @@ * 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. - */package org.apache.tika.renderer; + */ +package org.apache.tika.renderer; import java.io.IOException; import java.io.InputStream; diff --git a/tika-core/src/main/java/org/apache/tika/sax/SafeContentHandler.java b/tika-core/src/main/java/org/apache/tika/sax/SafeContentHandler.java index b04c32768..a493084c2 100644 --- a/tika-core/src/main/java/org/apache/tika/sax/SafeContentHandler.java +++ b/tika-core/src/main/java/org/apache/tika/sax/SafeContentHandler.java @@ -16,11 +16,6 @@ */ package org.apache.tika.sax; -/* -import java.util.ArrayList; -import java.util.List; -*/ - import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; import org.xml.sax.SAXException; diff --git a/tika-fuzzing/src/test/java/TestFuzzingCLI.java b/tika-fuzzing/src/test/java/org/apache/tika/fuzzing/TestFuzzingCLI.java similarity index 98% rename from tika-fuzzing/src/test/java/TestFuzzingCLI.java rename to tika-fuzzing/src/test/java/org/apache/tika/fuzzing/TestFuzzingCLI.java index 9e3e49dc0..752bf6e12 100644 --- a/tika-fuzzing/src/test/java/TestFuzzingCLI.java +++ b/tika-fuzzing/src/test/java/org/apache/tika/fuzzing/TestFuzzingCLI.java @@ -1,4 +1,4 @@ -/* +package org.apache.tika.fuzzing;/* * 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. diff --git a/tika-fuzzing/src/test/java/TestTransformer.java b/tika-fuzzing/src/test/java/org/apache/tika/fuzzing/TestTransformer.java similarity index 98% rename from tika-fuzzing/src/test/java/TestTransformer.java rename to tika-fuzzing/src/test/java/org/apache/tika/fuzzing/TestTransformer.java index 3adc4e3e1..581972f5a 100644 --- a/tika-fuzzing/src/test/java/TestTransformer.java +++ b/tika-fuzzing/src/test/java/org/apache/tika/fuzzing/TestTransformer.java @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +package org.apache.tika.fuzzing; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; diff --git a/tika-parent/checkstyle.xml b/tika-parent/checkstyle.xml index 55dc19fe7..cf9928edf 100644 --- a/tika-parent/checkstyle.xml +++ b/tika-parent/checkstyle.xml @@ -40,7 +40,7 @@ <module name="RegexpHeader"> <property name="header" - value="^.*$\n^\W*Licensed to the Apache Software Foundation \(ASF\) under one or more$"/> + value="^.*$\n^\W*Licensed to the Apache Software Foundation \(ASF\) under one or more"/> </module> <!-- Checks for whitespace --> @@ -77,16 +77,6 @@ <module name="AvoidStarImport"/> <module name="UnusedImports"/> <module name="OneTopLevelClass"/> - <module name="NoLineWrap"/> - <!--<module name="NeedBraces"/>--> - <!--<module name="LeftCurly">--> - <!--<property name="maxLineLength" value="100"/>--> - <!--</module>--> - <!--<module name="RightCurly"/>--> - <!--<module name="RightCurly">--> - <!--<property name="option" value="alone"/>--> - <!--<property name="tokens" value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, LITERAL_DO, STATIC_INIT, INSTANCE_INIT"/>--> - <!--</module>--> <module name="WhitespaceAround"> <property name="allowEmptyConstructors" value="true"/> <property name="allowEmptyMethods" value="true"/> @@ -119,25 +109,9 @@ <message key="ws.notPreceded" value="GenericWhitespace ''{0}'' is not preceded with whitespace."/> </module> - <module name="Indentation"> - <property name="basicOffset" value="4"/> - <property name="braceAdjustment" value="0"/> - <property name="caseIndent" value="4"/> - <property name="throwsIndent" value="8"/> - <property name="lineWrappingIndentation" value="8"/> - <property name="arrayInitIndent" value="4"/> - <property name="severity" value="error"/> - </module> <module name="EmptyCatchBlock"> <property name="exceptionVariableName" value="expected|ignore"/> </module> - <module name="CustomImportOrder"> - <property name="sortImportsInGroupAlphabetically" value="true"/> - <property name="separateLineBetweenGroups" value="true"/> - <property name="specialImportsRegExp" value="apache\.tika\."/> - <property name="customImportOrderRules" - value="STATIC###STANDARD_JAVA_PACKAGE###THIRD_PARTY_PACKAGE###SPECIAL_IMPORTS"/> - </module> <module name="EqualsHashCode"/> <module name="ArrayTypeStyle"/> </module> diff --git a/tika-core/src/main/java/org/apache/tika/parser/RenderingParser.java b/tika-parent/license-header.txt similarity index 83% copy from tika-core/src/main/java/org/apache/tika/parser/RenderingParser.java copy to tika-parent/license-header.txt index 0daae6be1..d973dceda 100644 --- a/tika-core/src/main/java/org/apache/tika/parser/RenderingParser.java +++ b/tika-parent/license-header.txt @@ -13,12 +13,4 @@ * 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. - */package org.apache.tika.parser; - -import org.apache.tika.renderer.Renderer; - -public interface RenderingParser { - - void setRenderer(Renderer renderer); - -} + */ \ No newline at end of file diff --git a/tika-parent/pom.xml b/tika-parent/pom.xml index abd620adb..a29b76421 100644 --- a/tika-parent/pom.xml +++ b/tika-parent/pom.xml @@ -306,6 +306,7 @@ <!-- can't update to 11, needs jdk17 --> <puppycrawl.version>10.26.1</puppycrawl.version> <rat.version>0.17</rat.version> + <spotless.goal>apply</spotless.goal> <!-- dependency versions --> <!-- change threetenbp exclusion version --> @@ -1422,7 +1423,52 @@ </executions> </plugin> <plugin> - <!-- mvn validate --> + <groupId>com.diffplug.spotless</groupId> + <artifactId>spotless-maven-plugin</artifactId> + <version>3.1.0</version> + <configuration> + <java> + <includes> + <include>src/main/java/**/*.java</include> + <include>src/test/java/**/*.java</include> + </includes> + <excludes> + <exclude>**/CharsetDetector.java</exclude> + <exclude>**/CharsetMatch.java</exclude> + <exclude>**/CharsetRecog*.java</exclude> + <exclude>**/onenote/fsshttpb/unsigned/U*.java</exclude> + <exclude>**/IPTC.java</exclude> + <exclude>**/Photoshop.java</exclude> + <exclude>**/QuattroPro.java</exclude> + <exclude>**/WordPerfect.java</exclude> + <exclude>**/XMPRights.java</exclude> + </excludes> + <licenseHeader> + <!-- maybe jenkins will like this? --> + <file>${session.executionRootDirectory}/tika-parent/license-header.txt</file> + <delimiter>package</delimiter> + </licenseHeader> + <indent> + <spaces>true</spaces> + <spacesPerTab>4</spacesPerTab> + </indent> + <removeUnusedImports/> + <importOrder> + <order>\#,java|javax,,org.apache.tika</order> + </importOrder> + </java> + </configuration> + <executions> + <execution> + <goals> + <goal>${spotless.goal}</goal> + </goals> + <phase>initialize</phase> + </execution> + </executions> + </plugin> + <plugin> + <!-- mvn validate --> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <version>${checkstyle.plugin.version}</version> @@ -1436,7 +1482,7 @@ <executions> <execution> <id>validate</id> - <phase>validate</phase> + <phase>process-classes</phase> <configuration> <configLocation>checkstyle.xml</configLocation> <consoleOutput>false</consoleOutput> @@ -1547,6 +1593,14 @@ </plugins> </build> </profile> + <profile> + <id>ci</id> + <properties> + <!-- Override the Spotless goal when this profile is active --> + <spotless.goal>check</spotless.goal> + </properties> + </profile> + </profiles> <!-- <connection>scm:git:https://github.com/apache/</connection> diff --git a/tika-pipes/tika-pipes-iterators/tika-pipes-iterator-csv/src/test/java/TestCSVPipesIterator.java b/tika-pipes/tika-pipes-iterators/tika-pipes-iterator-csv/src/test/java/org/apache/tika/pipes/pipesiterator/csv/TestCSVPipesIterator.java similarity index 98% rename from tika-pipes/tika-pipes-iterators/tika-pipes-iterator-csv/src/test/java/TestCSVPipesIterator.java rename to tika-pipes/tika-pipes-iterators/tika-pipes-iterator-csv/src/test/java/org/apache/tika/pipes/pipesiterator/csv/TestCSVPipesIterator.java index 772c399cc..336cf90d5 100644 --- a/tika-pipes/tika-pipes-iterators/tika-pipes-iterator-csv/src/test/java/TestCSVPipesIterator.java +++ b/tika-pipes/tika-pipes-iterators/tika-pipes-iterator-csv/src/test/java/org/apache/tika/pipes/pipesiterator/csv/TestCSVPipesIterator.java @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +package org.apache.tika.pipes.pipesiterator.csv; import static org.apache.tika.pipes.pipesiterator.PipesIterator.COMPLETED_SEMAPHORE; import static org.junit.jupiter.api.Assertions.assertEquals;
