Skip to content

Commit 0e79fc6

Browse files
committed
HV-2051 Add spotless config
1 parent 86381b0 commit 0e79fc6

File tree

3 files changed

+93
-0
lines changed

3 files changed

+93
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/*
2+
* Hibernate Validator, declare and validate application constraints
3+
*
4+
* License: Apache License, Version 2.0
5+
* See the license.txt file in the root directory or <http://www.apache.org/licenses/LICENSE-2.0>.
6+
*/
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<!--
2+
~ Hibernate Validator, declare and validate application constraints
3+
~
4+
~ License: Apache License, Version 2.0
5+
~ See the license.txt file in the root directory or <http://www.apache.org/licenses/LICENSE-2.0>.
6+
-->

pom.xml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@
271271
<version.formatter-maven-plugin>2.24.1</version.formatter-maven-plugin>
272272
<version.versions.plugin>2.17.1</version.versions.plugin>
273273
<version.maven-wrapper-plugin>3.3.2</version.maven-wrapper-plugin>
274+
<version.spotless-maven-plugin>2.43.0</version.spotless-maven-plugin>
274275

275276
<!-- Forbidden API related properties -->
276277
<forbiddenapis-junit.path>forbidden-junit.txt</forbiddenapis-junit.path>
@@ -1469,6 +1470,86 @@
14691470
</execution>
14701471
</executions>
14711472
</plugin>
1473+
<plugin>
1474+
<groupId>com.diffplug.spotless</groupId>
1475+
<artifactId>spotless-maven-plugin</artifactId>
1476+
<version>${version.spotless-maven-plugin}</version>
1477+
<configuration>
1478+
<upToDateChecking>
1479+
<enabled>true</enabled>
1480+
<indexFile>.cache/spotless-index-${version.spotless-maven-plugin}</indexFile>
1481+
</upToDateChecking>
1482+
<formats>
1483+
<format>
1484+
<!-- XML specific rules -->
1485+
<includes>
1486+
<include>src/**/*.xml</include>
1487+
</includes>
1488+
<trimTrailingWhitespace/>
1489+
<endWithNewline/>
1490+
<licenseHeader>
1491+
<file>license.xml.header</file>
1492+
<!-- Delimiter is a regex which identifies the "top" of the file i.e. all above it is considered a header -->
1493+
<delimiter><![CDATA[(\n)*^(<[^!?]+|<!DOCTYPE.+)$]]></delimiter>
1494+
<skipLinesMatching><![CDATA[<\?xml.+\?>]]></skipLinesMatching>
1495+
</licenseHeader>
1496+
<indent>
1497+
<tabs>true</tabs>
1498+
<spacesPerTab>4</spacesPerTab>
1499+
</indent>
1500+
</format>
1501+
</formats>
1502+
<!-- define a language-specific format -->
1503+
<java>
1504+
<toggleOffOn/>
1505+
<includes>
1506+
<include>src/**/*.java</include>
1507+
</includes>
1508+
<excludes>
1509+
<exclude>**/TypeHelper.java</exclude>
1510+
<exclude>**/TypeHelperTest.java</exclude>
1511+
<exclude>**/ConcurrentReferenceHashMap.java</exclude>
1512+
</excludes>
1513+
<indent>
1514+
<tabs>true</tabs>
1515+
<spacesPerTab>4</spacesPerTab>
1516+
</indent>
1517+
1518+
<importOrder>
1519+
<!-- you can use an empty string for all the imports you didn't specify explicitly, '|' to join group without blank line, and '\#` prefix for static imports. -->
1520+
<order>\#,java,javax,jakarta,org.openjdk.jmh,org.hibernate,org.hibernate.testing,org.hibernate.test,org.junit,org.jboss,com,javafx.beans,</order>
1521+
</importOrder>
1522+
<trimTrailingWhitespace/>
1523+
<endWithNewline/>
1524+
<eclipse>
1525+
<!-- optional version of Eclipse Formatter -->
1526+
<!-- <version>4.26</version> -->
1527+
<file>hibernate_validator_style.xml</file>
1528+
</eclipse>
1529+
<removeUnusedImports>
1530+
<!-- default one fails to process the classes -->
1531+
<engine>cleanthat-javaparser-unnecessaryimport</engine>
1532+
</removeUnusedImports>
1533+
<licenseHeader>
1534+
<file>license.java.header</file>
1535+
<!-- Delimiter is a regex which identifies the "top" of the file i.e. all above it is considered a header -->
1536+
<delimiter>(\n)*^(\/\/tag.+|\/\/spotless.+|package .+;|//.+)$</delimiter>
1537+
</licenseHeader>
1538+
<replaceRegex>
1539+
<name>Remove wildcard imports</name>
1540+
<searchRegex>^import\s+[^\*\s]+\*;$</searchRegex>
1541+
<replacement>$1</replacement>
1542+
</replaceRegex>
1543+
</java>
1544+
</configuration>
1545+
<dependencies>
1546+
<dependency>
1547+
<groupId>org.hibernate.validator</groupId>
1548+
<artifactId>hibernate-validator-build-config</artifactId>
1549+
<version>${project.version}</version>
1550+
</dependency>
1551+
</dependencies>
1552+
</plugin>
14721553
<plugin>
14731554
<groupId>org.moditect</groupId>
14741555
<artifactId>moditect-maven-plugin</artifactId>

0 commit comments

Comments
 (0)