diff --git a/build.gradle b/build.gradle index 3cc6fa0c4..ebac57210 100644 --- a/build.gradle +++ b/build.gradle @@ -30,6 +30,7 @@ allprojects { nanojsonVersion = "1d9e1aea9049fc9f85e68b43ba39fe7be1c1f751" spotbugsVersion = "4.6.0" junitVersion = "5.8.2" + checkstyleVersion = "9.3" // do not use latest version (10.0) as it requires compile SDK 11 } } diff --git a/checkstyle/checkstyle.xml b/checkstyle/checkstyle.xml new file mode 100644 index 000000000..4a82f6be3 --- /dev/null +++ b/checkstyle/checkstyle.xml @@ -0,0 +1,189 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/extractor/build.gradle b/extractor/build.gradle index a9b5f7f3e..70b51a338 100644 --- a/extractor/build.gradle +++ b/extractor/build.gradle @@ -1,9 +1,25 @@ +plugins { + id 'checkstyle' +} + test { -// Pass on downloader type to tests for different CI jobs. See DownloaderFactory.java and ci.yml + // Pass on downloader type to tests for different CI jobs. See DownloaderFactory.java and ci.yml if (System.properties.containsKey('downloader')) { systemProperty('downloader', System.getProperty('downloader')) } useJUnitPlatform() + dependsOn checkstyleMain // run checkstyle when testing +} + +checkstyle { + getConfigDirectory().set(rootProject.file("checkstyle")) + ignoreFailures false + showViolations true + toolVersion checkstyleVersion +} + +checkstyleTest { + enabled false // do not checkstyle test files } dependencies { @@ -15,6 +31,8 @@ dependencies { implementation "com.github.spotbugs:spotbugs-annotations:$spotbugsVersion" implementation 'org.nibor.autolink:autolink:0.10.0' + checkstyle "com.puppycrawl.tools:checkstyle:$checkstyleVersion" + testImplementation platform("org.junit:junit-bom:$junitVersion") testImplementation 'org.junit.jupiter:junit-jupiter-api' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'