Skip to content

Commit 5c5afae

Browse files
committed
Enable checkstyle and spotlessCheck for h2 on CI
Also, disable redundant checkstyle rules, always disable spotlessApply on CI and fix a couple code-formatting issues.
1 parent cbdbb27 commit 5c5afae

File tree

4 files changed

+37
-27
lines changed

4 files changed

+37
-27
lines changed

ci/build.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,18 @@ elif [ "$RDBMS" == "informix" ]; then
7676
goal="-Pdb=informix"
7777
fi
7878

79-
# Disable checkstyle
80-
#if [ -n "$goal" ]; then
81-
goal="$goal -x checkstyleMain -DPOPULATE_REMOTE=true"
82-
#fi
79+
# Only run checkstyle and spotlessCheck in the H2 build,
80+
# so that CI jobs give a more complete report
81+
# and developers can fix code style and non-H2 DB tests in parallel.
82+
if [ -n "$goal" ]; then
83+
goal="$goal -x checkstyleMain -DPOPULATE_REMOTE=true"
84+
else
85+
goal="$goal spotlessCheck"
86+
fi
8387

8488
function logAndExec() {
8589
echo 1>&2 "Executing:" "${@}"
8690
exec "${@}"
8791
}
8892

89-
logAndExec ./gradlew check ${goal} "${@}" -Plog-test-progress=true --stacktrace
93+
logAndExec ./gradlew check -x spotlessApply ${goal} "${@}" -Plog-test-progress=true --stacktrace

hibernate-core/src/main/java/org/hibernate/dialect/OracleUserDefinedTypeExporter.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,15 +312,17 @@ public String[] getSqlDropStrings(UserDefinedArrayType userDefinedType, Metadata
312312
private String buildDropTypeSqlString(String arrayTypeName) {
313313
if ( dialect.supportsIfExistsBeforeTypeName() ) {
314314
return "drop type if exists " + arrayTypeName + " force";
315-
} else {
315+
}
316+
else {
316317
return "drop type " + arrayTypeName + " force";
317318
}
318319
}
319320

320321
private String buildDropFunctionSqlString(String functionTypeName) {
321322
if ( supportsIfExistsBeforeFunctionName() ) {
322323
return "drop function if exists " + functionTypeName;
323-
} else {
324+
}
325+
else {
324326
return "drop function " + functionTypeName;
325327
}
326328
}

shared/config/checkstyle/checkstyle-non-fatal.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@
1818
<property name="severity" value="warning" />
1919
</module>
2020

21-
<module name="UnusedImports">
21+
<!--enforced by indentWithTabs-->
22+
<!--<module name="UnusedImports">
2223
<property name="severity" value="warning" />
23-
</module>
24+
</module>-->
2425

2526
<module name="AvoidNestedBlocks">
2627
<property name="allowInSwitchCase" value="true" />

shared/config/checkstyle/checkstyle.xml

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010

1111
<!-- Only defines "fatal" violations; there are additional "non-fatal" rules in checkstyle-non-fatal.xml -->
1212

13-
<module name="RegexpHeader">
14-
<property name="header" value=""/>
15-
<property name="fileExtensions" value="\/\*\n * SPDX-License-Identifier: LGPL-2.1-or-later\n \* Copyright Red Hat Inc. and Hibernate Authors\n \*\/java"/>
16-
</module>
13+
<!-- enforced by spotless licenseHeaderFile-->
14+
<!-- <module name="RegexpHeader">-->
15+
<!-- <property name="header" value=""/>-->
16+
<!-- <property name="fileExtensions" value="\/\*\n * SPDX-License-Identifier: LGPL-2.1-or-later\n \* Copyright Red Hat Inc. and Hibernate Authors\n \*\/java"/>-->
17+
<!-- </module>-->
1718

1819
<module name="RegexpHeader">
1920
<property name="header" value="&lt;\?xml version\=&quot;1.0&quot; encoding\=&quot;UTF-8&quot;\?&gt;\n&lt;!--\n ~ Hibernate, Relational Persistence for Idiomatic Java\n ~\n ~ License: GNU Lesser General Public License \(LGPL\), version 2\.1 or later[\.]?\n ~ See the lgpl.txt file in the root directory or [&lt;]?http:\/\/www\.gnu\.org\/licenses\/lgpl-2\.1\.html[&gt;]?[.]?\n --&gt;"/>
@@ -25,11 +26,12 @@
2526
<!--
2627
High-priority warnings : fail the build...
2728
-->
28-
<module name="RegexpSinglelineJava">
29-
<property name="ignoreComments" value="true" />
30-
<property name="format" value="^\t* +\t*\S" />
31-
<property name="message" value="Line has leading space characters; indentation should be performed with tabs only." />
32-
</module>
29+
<!-- enforced by indentWithTabs-->
30+
<!-- <module name="RegexpSinglelineJava">-->
31+
<!-- <property name="ignoreComments" value="true" />-->
32+
<!-- <property name="format" value="^\t* +\t*\S" />-->
33+
<!-- <property name="message" value="Line has leading space characters; indentation should be performed with tabs only." />-->
34+
<!-- </module>-->
3335

3436
<module name="Regexp">
3537
<property name="format" value="/^(master|slave)$/"/>
@@ -91,14 +93,15 @@
9193
on different operating systems and that rule allows only one type. This rule
9294
is not actually checking for new lines, but it will work if we check that
9395
there are not white spaces at the end of a line with another rule. -->
94-
<module name="RegexpMultiline">
95-
<property name="format" value="\S\z" />
96-
<property name="message" value="Missing new line at the end of file" />
97-
</module>
98-
99-
<module name="RegexpMultiline">
100-
<property name="format" value="\S(r?\n){5,}\z" />
101-
<property name="message" value="Files should end with no more than 5 (empty) new lines" />
102-
</module>
96+
<!-- enforced by spotless endWithNewline-->
97+
<!-- <module name="RegexpMultiline">-->
98+
<!-- <property name="format" value="\S\z" />-->
99+
<!-- <property name="message" value="Missing new line at the end of file" />-->
100+
<!-- </module>-->
101+
102+
<!-- <module name="RegexpMultiline">-->
103+
<!-- <property name="format" value="\S(r?\n){5,}\z" />-->
104+
<!-- <property name="message" value="Files should end with no more than 5 (empty) new lines" />-->
105+
<!-- </module>-->
103106

104107
</module>

0 commit comments

Comments
 (0)