diff --git a/.github/workflows/atlas.yml b/.github/workflows/atlas.yml
index 64dc670d6d..d951494470 100644
--- a/.github/workflows/atlas.yml
+++ b/.github/workflows/atlas.yml
@@ -113,6 +113,5 @@ jobs:
name: test-reports-java11-${{ matrix.rdbms }}
path: |
./**/target/reports/tests/
- ./**/target/reports/checkstyle/
- name: Omit produced artifacts from build cache
run: ./ci/before-cache.sh
\ No newline at end of file
diff --git a/.github/workflows/contributor-build.yml b/.github/workflows/contributor-build.yml
index 440632c9b3..b293b047d0 100644
--- a/.github/workflows/contributor-build.yml
+++ b/.github/workflows/contributor-build.yml
@@ -121,6 +121,5 @@ jobs:
name: test-reports-java11-${{ matrix.rdbms }}
path: |
./**/target/reports/tests/
- ./**/target/reports/checkstyle/
- name: Omit produced artifacts from build cache
run: ./ci/before-cache.sh
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
index 2a318cb581..582f558557 100644
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -3,12 +3,12 @@
-
-
+
+
\ No newline at end of file
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index ff201f2a25..c1ae3ab030 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -83,7 +83,6 @@ Do your thing!
up the related commits and display them on the JIRA issue
* Make sure you have added the necessary tests for your changes
* Run _all_ the tests to ensure nothing else was accidentally broken
-* Make sure your source does not violate the _checkstyles_
_Before committing, if you want to pull in the latest upstream changes (highly
appreciated btw), please use rebasing rather than merging. Merging creates
diff --git a/ci/build.sh b/ci/build.sh
index a07e4e2a51..e1ae09d2f8 100755
--- a/ci/build.sh
+++ b/ci/build.sh
@@ -76,11 +76,6 @@ elif [ "$RDBMS" == "informix" ]; then
goal="-Pdb=informix"
fi
-# Disable checkstyle
-#if [ -n "$goal" ]; then
-goal="$goal -x checkstyleMain -DPOPULATE_REMOTE=true"
-#fi
-
function logAndExec() {
echo 1>&2 "Executing:" "${@}"
exec "${@}"
diff --git a/gradle/java-module.gradle b/gradle/java-module.gradle
index 1c033f8f88..44f48563f1 100644
--- a/gradle/java-module.gradle
+++ b/gradle/java-module.gradle
@@ -36,7 +36,6 @@ apply plugin: 'de.thetaphi.forbiddenapis'
apply plugin: 'com.diffplug.spotless'
apply plugin: "jacoco"
-apply plugin: 'checkstyle'
apply plugin: 'build-dashboard'
apply plugin: 'project-report'
@@ -448,26 +447,37 @@ tasks.copyResourcesToIntelliJOutFolder.mustRunAfter processTestResources
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Report configs
-checkstyle {
- it.sourceSets = [ project.sourceSets.main ]
- configFile = rootProject.file( 'shared/config/checkstyle/checkstyle.xml' )
- showViolations = false
-}
-
-// exclude generated java sources - by explicitly setting the base source dir
-tasks.checkstyleMain.source = 'src/main/java'
-tasks.checkstyleMain
- .exclude('org/hibernate/processor/util/NullnessUtil.java')
- .exclude('org/hibernate/internal/util/NullnessUtil.java')
-// For some big files we need more heap memory than the default 512m for parsing
-tasks.checkstyleMain.maxHeapSize = "640m"
-
-// define a second checkstyle task for checking non-fatal violations
-task nonFatalCheckstyle(type:Checkstyle) {
- source = project.sourceSets.main.java
- classpath = project.configurations.checkstyle
- showViolations = false
- configFile = rootProject.file( 'shared/config/checkstyle/checkstyle-non-fatal.xml' )
+task enforceRules {
+ doLast {
+ def illegalImport = ~/^import (sun|java.awt|org.slf4j)/
+ def missingNewline = ~/^\s*}\s*(else|catch|finally)/
+ def lowerEll = ~/\b\d+l\b/
+ def errors = 0
+ def tree = fileTree("src/main/java/")
+ tree.include "**/*.java"
+ tree.each { file ->
+ def lineNum = 0
+ def shortName = file.path.substring(rootDir.path.length())
+ file.eachLine { line ->
+ lineNum++
+ if (line =~ illegalImport) {
+ errors++
+ logger.error("Illegal import in ${shortName}\n${lineNum}: ${line}")
+ }
+ if (line =~ missingNewline) {
+ errors++
+ logger.error("Missing newline in ${shortName}\n${lineNum}: ${line}")
+ }
+ if (line =~ lowerEll) {
+ errors++
+ logger.error("Lowercase long literal in ${shortName}\n${lineNum}: ${line}")
+ }
+ }
+ }
+ if ( errors>0 ) {
+ throw new GradleException("Code rules were violated ($errors problems)")
+ }
+ }
}
spotless {
@@ -483,6 +493,8 @@ spotless {
}
}
+tasks.spotlessApply.dependsOn enforceRules
+
class CompilerStubsArgumentProvider implements CommandLineArgumentProvider {
diff --git a/hibernate-integrationtest-java-modules/hibernate-integrationtest-java-modules.gradle b/hibernate-integrationtest-java-modules/hibernate-integrationtest-java-modules.gradle
index 3dceffd867..553966abd1 100644
--- a/hibernate-integrationtest-java-modules/hibernate-integrationtest-java-modules.gradle
+++ b/hibernate-integrationtest-java-modules/hibernate-integrationtest-java-modules.gradle
@@ -14,9 +14,6 @@ apply from: rootProject.file( 'gradle/java-module.gradle' )
java.modularity.inferModulePath = true
-// Checkstyle fails for module-info
-checkstyleMain.exclude '**/module-info.java'
-
dependencies {
api project( ':hibernate-core' )
api project( ':hibernate-envers' )
diff --git a/hibernate-testing/hibernate-testing.gradle b/hibernate-testing/hibernate-testing.gradle
index b888aa182b..ed0bf21cd5 100644
--- a/hibernate-testing/hibernate-testing.gradle
+++ b/hibernate-testing/hibernate-testing.gradle
@@ -49,6 +49,3 @@ dependencies {
annotationProcessor project( ':hibernate-processor' )
}
-tasks.checkstyleMain {
- exclude '**/org/hibernate/orm/test/legacy/**'
-}
diff --git a/release/jenkins-release-process.adoc b/release/jenkins-release-process.adoc
index e6232614e1..56b5cae400 100644
--- a/release/jenkins-release-process.adoc
+++ b/release/jenkins-release-process.adoc
@@ -15,7 +15,7 @@ First, a list of resources you will need access to in order to perform a release
== Steps
-1. Perform `./gradlew preVerifyRelease` locally (after pulling all upstream changes). The Jenkins job does only the release steps, and we need to make sure tests and checkstyle especially are ok
+1. Perform `./gradlew preVerifyRelease` locally (after pulling all upstream changes). The Jenkins job does only the release steps, and we need to make sure tests are ok
2. Mark the version as released in Jira
3. Close all issues associated with the version as closed. Be sure to remove the version from any issues that are not resolved (e.g. rejected) - the Jira "release notes" mechanism includes all issues with that version as the fix-for regardless of the resolution
4. Start the https://ci.hibernate.org/view/Release/job/hibernate-orm-release-jdk17/[Jenkins job]. It is a parameterized build - Jenkins will prompt user for needed information:
diff --git a/shared/config/checkstyle/checkstyle-non-fatal.xml b/shared/config/checkstyle/checkstyle-non-fatal.xml
deleted file mode 100644
index dff679e6fd..0000000000
--- a/shared/config/checkstyle/checkstyle-non-fatal.xml
+++ /dev/null
@@ -1,186 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/shared/config/checkstyle/checkstyle.xml b/shared/config/checkstyle/checkstyle.xml
deleted file mode 100644
index fba81710c8..0000000000
--- a/shared/config/checkstyle/checkstyle.xml
+++ /dev/null
@@ -1,104 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tooling/hibernate-gradle-plugin/hibernate-gradle-plugin.gradle b/tooling/hibernate-gradle-plugin/hibernate-gradle-plugin.gradle
index 2a979f6921..f1717e5056 100644
--- a/tooling/hibernate-gradle-plugin/hibernate-gradle-plugin.gradle
+++ b/tooling/hibernate-gradle-plugin/hibernate-gradle-plugin.gradle
@@ -11,8 +11,6 @@ plugins {
id 'java-gradle-plugin'
id 'com.gradle.plugin-publish' version '1.2.1'
- id 'checkstyle'
-
// for local publishing
id 'maven-publish'
}
@@ -131,12 +129,6 @@ tasks.named( "javadoc", Javadoc ) {
}
}
-checkstyle {
- sourceSets = [ project.sourceSets.main ]
- configFile = rootProject.file( 'shared/config/checkstyle/checkstyle.xml' )
- showViolations = false
-}
-
tasks.publish.enabled !project.ormVersion.isSnapshot
tasks.publishPlugins.enabled !project.ormVersion.isSnapshot