From 4015dd50750647804252dc2fce11c169ec18cd7b Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Wed, 13 Sep 2023 14:50:30 +0200 Subject: [PATCH 1/3] enable checkstyle plugin --- .../groovy/org.lflang.java-conventions.gradle | 13 + checkstyle.xml | 383 ++++++++++++++++++ gradle.properties | 1 + 3 files changed, 397 insertions(+) create mode 100644 checkstyle.xml diff --git a/buildSrc/src/main/groovy/org.lflang.java-conventions.gradle b/buildSrc/src/main/groovy/org.lflang.java-conventions.gradle index 9fc4fa50f9..47833fa90c 100644 --- a/buildSrc/src/main/groovy/org.lflang.java-conventions.gradle +++ b/buildSrc/src/main/groovy/org.lflang.java-conventions.gradle @@ -2,6 +2,7 @@ plugins { id 'java' id 'com.diffplug.spotless' id 'org.lflang.platform' + id 'checkstyle' } repositories { @@ -43,3 +44,15 @@ configurations.all { } } } + +checkstyle { + toolVersion = "${checkstyleToolVersion}" + ignoreFailures = false + configFile = rootProject.file("checkstyle.xml") +} + +tasks.withType(Checkstyle) { + exclude { FileTreeElement el -> + return el.file.absolutePath.contains('src-gen') || el.file.absolutePath.contains('test-gen') || el.file.absolutePath.contains('build') + } +} \ No newline at end of file diff --git a/checkstyle.xml b/checkstyle.xml new file mode 100644 index 0000000000..b5341b964b --- /dev/null +++ b/checkstyle.xml @@ -0,0 +1,383 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gradle.properties b/gradle.properties index 4b062644e0..fe779bb05a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,6 +21,7 @@ xtextVersion=2.31.0 klighdVersion=2.3.0.v20230606 freehepVersion=2.4 swtVersion=3.124.0 +checkstyleToolVersion=10.12.3 [manifestPropertyNames] org.eclipse.xtext=xtextVersion From d310b1be38f4f32918011b29d65e0827c9c555cc Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Wed, 13 Sep 2023 16:02:27 +0200 Subject: [PATCH 2/3] move checkstyle configuration --- buildSrc/src/main/groovy/org.lflang.java-conventions.gradle | 2 +- checkstyle.xml => config/checkstyle/google_checks.xml | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename checkstyle.xml => config/checkstyle/google_checks.xml (100%) diff --git a/buildSrc/src/main/groovy/org.lflang.java-conventions.gradle b/buildSrc/src/main/groovy/org.lflang.java-conventions.gradle index 47833fa90c..b8a33331c2 100644 --- a/buildSrc/src/main/groovy/org.lflang.java-conventions.gradle +++ b/buildSrc/src/main/groovy/org.lflang.java-conventions.gradle @@ -48,7 +48,7 @@ configurations.all { checkstyle { toolVersion = "${checkstyleToolVersion}" ignoreFailures = false - configFile = rootProject.file("checkstyle.xml") + configFile = rootProject.file("config/checkstyle/google_checks.xml") } tasks.withType(Checkstyle) { diff --git a/checkstyle.xml b/config/checkstyle/google_checks.xml similarity index 100% rename from checkstyle.xml rename to config/checkstyle/google_checks.xml From 3864ebc8eeb146ab0b37faf1305ec7751565538c Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Wed, 13 Sep 2023 16:19:59 +0200 Subject: [PATCH 3/3] formatting --- buildSrc/src/main/groovy/org.lflang.java-conventions.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/groovy/org.lflang.java-conventions.gradle b/buildSrc/src/main/groovy/org.lflang.java-conventions.gradle index b8a33331c2..1cfe2f3f7d 100644 --- a/buildSrc/src/main/groovy/org.lflang.java-conventions.gradle +++ b/buildSrc/src/main/groovy/org.lflang.java-conventions.gradle @@ -55,4 +55,4 @@ tasks.withType(Checkstyle) { exclude { FileTreeElement el -> return el.file.absolutePath.contains('src-gen') || el.file.absolutePath.contains('test-gen') || el.file.absolutePath.contains('build') } -} \ No newline at end of file +}