Skip to content

Commit

Permalink
headers and checkstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
sebersole committed Oct 27, 2023
1 parent 25dc1c9 commit 3cff323
Show file tree
Hide file tree
Showing 82 changed files with 279 additions and 150 deletions.
98 changes: 98 additions & 0 deletions config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Hibernate, Relational Persistence for Idiomatic Java
~
~ License: GNU Lesser General Public License (LGPL), version 2.1 or later.
~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
-->
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.1//EN" "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<module name="Checker">

<module name="Header">
<property name="headerFile" value="${config_loc}/headers/header-java.txt"/>
<property name="fileExtensions" value="java,gradle,groovy"/>
</module>

<module name="Header">
<property name="headerFile" value="${config_loc}/headers/header-xml.txt"/>
<property name="fileExtensions" value="xml,xsd,xjb"/>
</module>

<module name="TreeWalker">
<module name="RegexpSinglelineJava">
<property name="ignoreComments" value="true" />
<property name="format" value="^\t* +\t*\S" />
<property name="message" value="Line has leading space characters; indentation should be performed with tabs only." />
</module>

<module name="Regexp">
<property name="format" value="/^(master|slave)$/"/>
<property name="illegalPattern" value="true"/>
<property name="message" value="Conscious Language (use of terms 'master' or 'slave' not allowed)"/>
</module>

<module name="MissingDeprecated" />

<module name="MissingOverride" />

<module name="PackageAnnotation" />

<module name="NeedBraces" />

<module name="LeftCurly">
<property name="option" value="eol" />
</module>

<module name="RightCurly">
<property name="option" value="alone" />
</module>

<module name="EqualsHashCode" />

<module name="StringLiteralEquality" />

<module name="NoFinalizer" />

<module name="OneStatementPerLine" />

<module name="UpperEll" />

<module name="IllegalImport">
<property name="illegalPkgs" value="java.awt, sun, org.slf4j"/>
</module>

<!--
Source code comment-based suppressions
-->
<module name="SuppressionCommentFilter">
<!--
Allow a finalize() method within these comments. DriverManagerConnectionProviderImpl e.g.
uses a finalizer to make sure we release all of its cached connections.
-->
<property name="offCommentFormat" value="CHECKSTYLE:START_ALLOW_FINALIZER"/>
<property name="onCommentFormat" value="CHECKSTYLE:END_ALLOW_FINALIZER"/>
<property name="checkFormat" value="NoFinalizer"/>
</module>

<module name="SuppressWithNearbyCommentFilter">
<property name="commentFormat" value="noinspection StatementWithEmptyBody"/>
<property name="checkFormat" value="EmptyStatement"/>
<property name="influenceFormat" value="1"/>
</module>
</module>

<!-- We are not using NewLineAtEndOfFile because the new line chars change
on different operating systems and that rule allows only one type. This rule
is not actually checking for new lines, but it will work if we check that
there are not white spaces at the end of a line with another rule. -->
<module name="RegexpMultiline">
<property name="format" value="\S\z" />
<property name="message" value="Missing new line at the end of file" />
</module>

<module name="RegexpMultiline">
<property name="format" value="\S(r?\n){5,}\z" />
<property name="message" value="Files should end with no more than 5 (empty) new lines" />
</module>

</module>
6 changes: 6 additions & 0 deletions config/checkstyle/headers/header-java.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* SPDX-License-Identifier: Apache-2.0
* Copyright: Red Hat Inc. and Hibernate Authors
*/
8 changes: 8 additions & 0 deletions config/checkstyle/headers/header-xml.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
~ Hibernate, Relational Persistence for Idiomatic Java
~
~ SPDX-License-Identifier: Apache-2.0
~ Copyright: Red Hat Inc. and Hibernate Authors
-->
8 changes: 8 additions & 0 deletions gradle/checkstyle.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apply plugin: 'checkstyle'

checkstyle {
sourceSets = [ project.sourceSets.main ]
showViolations = false
}
// only include explicit sources (and thereby exclude generated sources)
tasks.checkstyleMain.source = 'src/main'
4 changes: 3 additions & 1 deletion gradle/java-module.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
apply plugin: "java-library"
apply from: rootProject.file( "gradle/module.gradle" )
apply from: rootProject.file( "gradle/checkstyle.gradle" )


dependencies {
testImplementation testLibs.junit5Api
Expand Down Expand Up @@ -29,4 +31,4 @@ tasks.withType( JavaCompile ).configureEach {
tasks.register( "compile" ) {compile->
compile.dependsOn tasks.named( sourceSets.main.compileJavaTaskName )
compile.dependsOn tasks.named( sourceSets.test.compileJavaTaskName )
}
}
1 change: 0 additions & 1 deletion hibernate-models-common/hibernate-models-common.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
apply from: rootProject.file( "gradle/java-module.gradle" )

Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
*/

/**
* Overall, this module is responsible for taking
* Overall, this module is responsible for taking a
* {@linkplain org.hibernate.boot.model.process.spi.ManagedResources managed-resources} and
* binding them into Hibernate's {@linkplain org.hibernate.mapping boot-time model}.
*
* @author Steve Ebersole
*/
package org.hibernate.models.orm;
package org.hibernate.models.orm;
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@
*
* @author Steve Ebersole
*/
package org.hibernate.models.orm.xml.internal;
package org.hibernate.models.orm.xml.internal;
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
* applies overlay/override XML.
* </li>
* </ol>
* <p/>
* First step is some {@linkplain }
*
* @author Steve Ebersole
*/
package org.hibernate.models.orm.xml;
package org.hibernate.models.orm.xml;
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ public <V> V setAttributeValue(String name, V value) {
//noinspection unchecked
return (V) ( (Map<String,Object>) attributeValueMap ).put( name, value );
}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html.
* SPDX-License-Identifier: Apache-2.0
* Copyright: Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.boot.jaxb.internal;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
* SPDX-License-Identifier: Apache-2.0
* Copyright: Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.boot.jaxb.internal;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html.
* SPDX-License-Identifier: Apache-2.0
* Copyright: Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.boot.jaxb.internal;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
* SPDX-License-Identifier: Apache-2.0
* Copyright: Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.boot.jaxb.internal;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
* SPDX-License-Identifier: Apache-2.0
* Copyright: Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.boot.jaxb.internal;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
* SPDX-License-Identifier: Apache-2.0
* Copyright: Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.boot.jaxb.internal;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
* SPDX-License-Identifier: Apache-2.0
* Copyright: Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.boot.jaxb.internal;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
* SPDX-License-Identifier: Apache-2.0
* Copyright: Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.boot.jaxb.internal;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html.
* SPDX-License-Identifier: Apache-2.0
* Copyright: Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.boot.jaxb.internal;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
* SPDX-License-Identifier: Apache-2.0
* Copyright: Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.boot.jaxb.internal;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
* SPDX-License-Identifier: Apache-2.0
* Copyright: Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.boot.jaxb.internal;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
* SPDX-License-Identifier: Apache-2.0
* Copyright: Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.boot.jaxb.internal.stax;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
* SPDX-License-Identifier: Apache-2.0
* Copyright: Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.boot.jaxb.internal.stax;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
* SPDX-License-Identifier: Apache-2.0
* Copyright: Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.boot.jaxb.internal.stax;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
* SPDX-License-Identifier: Apache-2.0
* Copyright: Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.boot.jaxb.internal.stax;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
* SPDX-License-Identifier: Apache-2.0
* Copyright: Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.boot.jaxb.internal.stax;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
* SPDX-License-Identifier: Apache-2.0
* Copyright: Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.boot.jaxb.internal.stax;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html.
* SPDX-License-Identifier: Apache-2.0
* Copyright: Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.boot.jaxb.internal.stax;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html.
* SPDX-License-Identifier: Apache-2.0
* Copyright: Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.boot.jaxb.internal.stax;

Expand Down
Loading

0 comments on commit 3cff323

Please sign in to comment.