diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml
index e69de29..f6122cd 100644
--- a/.github/workflows/pages.yml
+++ b/.github/workflows/pages.yml
@@ -0,0 +1,57 @@
+name: javadocs-pages
+
+on:
+ # Runs on pushes targeting the default branch
+ push:
+ branches: ["master"]
+
+ # Allows you to run this workflow manually from the Actions tab
+ workflow_dispatch:
+
+# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
+permissions:
+ contents: read
+ pages: write
+ id-token: write
+
+# Allow one concurrent deployment
+concurrency:
+ group: "pages"
+ cancel-in-progress: true
+
+jobs:
+ # Single deploy job since we're just deploying
+ deploy:
+ environment:
+ name: github-pages
+ url: ${{ steps.deployment.outputs.page_url }}
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout source repository
+ uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+
+ - name: Set up JDK 17
+ uses: actions/setup-java@v3
+ with:
+ distribution: 'zulu'
+ java-version: 17
+
+ - name: Build Javadocs
+ run: ./bld download clean javadoc
+
+ - name: Setup Pages
+ uses: actions/configure-pages@v3
+
+ - name: Upload artifact
+ uses: actions/upload-pages-artifact@v1
+ with:
+ # Upload generated Javadocs repository
+ path: 'build/javadoc/'
+
+ - name: Deploy to GitHub Pages
+ id: deployment
+ uses: actions/deploy-pages@v1
\ No newline at end of file
diff --git a/.idea/copyright/Apache_License.xml b/.idea/copyright/Apache_License.xml
index 15687f4..ade80da 100644
--- a/.idea/copyright/Apache_License.xml
+++ b/.idea/copyright/Apache_License.xml
@@ -1,6 +1,6 @@
-
+
-
\ No newline at end of file
+
diff --git a/.idea/intellij-javadocs-4.0.1.xml b/.idea/intellij-javadocs-4.0.1.xml
new file mode 100644
index 0000000..90d3347
--- /dev/null
+++ b/.idea/intellij-javadocs-4.0.1.xml
@@ -0,0 +1,204 @@
+
+
+
+
+ UPDATE
+ false
+ true
+
+ FIELD
+ METHOD
+ TYPE
+
+
+ PUBLIC
+ PROTECTED
+ DEFAULT
+
+
+
+
+
+ ^.*(public|protected|private)*.+interface\s+\w+.*
+ /**\n
+ * The interface ${name}.\n
+<#if element.typeParameters?has_content> * \n
+</#if>
+<#list element.typeParameters as typeParameter>
+ * @param <${typeParameter.name}> the type parameter\n
+</#list>
+ */
+
+
+ ^.*(public|protected|private)*.+enum\s+\w+.*
+ /**\n
+ * The enum ${name}.\n
+ */
+
+
+ ^.*(public|protected|private)*.+class\s+\w+.*
+ /**\n
+ * The type ${name}.\n
+<#if element.typeParameters?has_content> * \n
+</#if>
+<#list element.typeParameters as typeParameter>
+ * @param <${typeParameter.name}> the type parameter\n
+</#list>
+ */
+
+
+ .+
+ /**\n
+ * The type ${name}.\n
+ */
+
+
+
+
+ .+
+ /**\n
+ * Instantiates a new ${name}.\n
+<#if element.parameterList.parameters?has_content>
+ *\n
+</#if>
+<#list element.parameterList.parameters as parameter>
+ * @param ${parameter.name} the ${paramNames[parameter.name]}\n
+</#list>
+<#if element.throwsList.referenceElements?has_content>
+ *\n
+</#if>
+<#list element.throwsList.referenceElements as exception>
+ * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
+</#list>
+ */
+
+
+
+
+ ^.*(public|protected|private)*\s*.*(\w(\s*<.+>)*)+\s+get\w+\s*\(.*\).+
+ /**\n
+ * Gets ${partName}.\n
+<#if element.typeParameters?has_content> * \n
+</#if>
+<#list element.typeParameters as typeParameter>
+ * @param <${typeParameter.name}> the type parameter\n
+</#list>
+<#if element.parameterList.parameters?has_content>
+ *\n
+</#if>
+<#list element.parameterList.parameters as parameter>
+ * @param ${parameter.name} the ${paramNames[parameter.name]}\n
+</#list>
+<#if isNotVoid>
+ *\n
+ * @return the ${partName}\n
+</#if>
+<#if element.throwsList.referenceElements?has_content>
+ *\n
+</#if>
+<#list element.throwsList.referenceElements as exception>
+ * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
+</#list>
+ */
+
+
+ ^.*(public|protected|private)*\s*.*(void|\w(\s*<.+>)*)+\s+set\w+\s*\(.*\).+
+ /**\n
+ * Sets ${partName}.\n
+<#if element.typeParameters?has_content> * \n
+</#if>
+<#list element.typeParameters as typeParameter>
+ * @param <${typeParameter.name}> the type parameter\n
+</#list>
+<#if element.parameterList.parameters?has_content>
+ *\n
+</#if>
+<#list element.parameterList.parameters as parameter>
+ * @param ${parameter.name} the ${paramNames[parameter.name]}\n
+</#list>
+<#if isNotVoid>
+ *\n
+ * @return the ${partName}\n
+</#if>
+<#if element.throwsList.referenceElements?has_content>
+ *\n
+</#if>
+<#list element.throwsList.referenceElements as exception>
+ * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
+</#list>
+ */
+
+
+ ^.*((public\s+static)|(static\s+public))\s+void\s+main\s*\(\s*String\s*(\[\s*\]|\.\.\.)\s+\w+\s*\).+
+ /**\n
+ * The entry point of application.\n
+
+ <#if element.parameterList.parameters?has_content>
+ *\n
+</#if>
+ * @param ${element.parameterList.parameters[0].name} the input arguments\n
+<#if element.throwsList.referenceElements?has_content>
+ *\n
+</#if>
+<#list element.throwsList.referenceElements as exception>
+ * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
+</#list>
+ */
+
+
+ .+
+ /**\n
+ * ${name}<#if isNotVoid> ${return}</#if>.\n
+<#if element.typeParameters?has_content> * \n
+</#if>
+<#list element.typeParameters as typeParameter>
+ * @param <${typeParameter.name}> the type parameter\n
+</#list>
+<#if element.parameterList.parameters?has_content>
+ *\n
+</#if>
+<#list element.parameterList.parameters as parameter>
+ * @param ${parameter.name} the ${paramNames[parameter.name]}\n
+</#list>
+<#if isNotVoid>
+ *\n
+ * @return the ${return}\n
+</#if>
+<#if element.throwsList.referenceElements?has_content>
+ *\n
+</#if>
+<#list element.throwsList.referenceElements as exception>
+ * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
+</#list>
+ */
+
+
+
+
+ ^.*(public|protected|private)*.+static.*(\w\s\w)+.+
+ /**\n
+ * The constant ${element.getName()}.\n
+ */
+
+
+ ^.*(public|protected|private)*.*(\w\s\w)+.+
+ /**\n
+ <#if element.parent.isInterface()>
+ * The constant ${element.getName()}.\n
+<#else>
+ * The ${name}.\n
+</#if> */
+
+
+ .+
+ /**\n
+ <#if element.parent.isEnum()>
+ *${name} ${typeName}.\n
+<#else>
+ * The ${name}.\n
+</#if>*/
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/bld.xml b/.idea/libraries/bld.xml
index cf75013..0b615c1 100644
--- a/.idea/libraries/bld.xml
+++ b/.idea/libraries/bld.xml
@@ -2,11 +2,12 @@
-
+
-
+
+
@@ -14,4 +15,4 @@
-
\ No newline at end of file
+
diff --git a/.idea/misc.xml b/.idea/misc.xml
index f03c702..1bf9192 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,3 +1,4 @@
+
@@ -8,6 +9,18 @@
diff --git a/.vscode/launch.json b/.vscode/launch.json
index 3d4eb53..2d63b46 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -5,7 +5,14 @@
"type": "java",
"name": "Run Tests",
"request": "launch",
- "mainClass": "rife.bld.extension.CheckstyleOperationTest"
+ "mainClass": "org.junit.platform.console.ConsoleLauncher",
+ "args": [
+ "--details=verbose",
+ "--scan-classpath",
+ "--disable-banner",
+ "--disable-ansi-colors",
+ "--exclude-engine=junit-platform-suite",
+ "--exclude-engine=junit-vintage"]
}
]
}
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 133aa45..9e8368e 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -3,13 +3,13 @@
"src/main/java",
"src/main/resources",
"src/test/java",
- "src/bld/java"
+ "src/test/resources",
+ "src/bld/java",
+ "src/bld/resources"
],
"java.configuration.updateBuildConfiguration": "automatic",
"java.project.referencedLibraries": [
- "${HOME}/.bld/dist/bld-1.7.5.jar",
- "lib/compile/*.jar",
- "lib/runtime/*.jar",
- "lib/test/*.jar"
+ "${HOME}/.bld/dist/bld-1.9.0.jar",
+ "lib/**/*.jar"
]
}
diff --git a/README.md b/README.md
index c0ee993..3cbe0e9 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,8 @@
-# [Checkstyle](https://checkstyle.sourceforge.io/) Extension for [bld](https://rife2.com/bldb)
+# [Checkstyle](https://checkstyle.sourceforge.io/) Extension for [bld](https://rife2.com/bldb)
[](https://opensource.org/licenses/Apache-2.0)
[](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html)
-[](https://rife2.com/bld)
+[](https://rife2.com/bld)
[](https://repo.rife2.com/#/releases/com/uwyn/rife2/bld-checkstyle)
[](https://repo.rife2.com/#/snapshots/com/uwyn/rife2/bld-checkstyle)
[](https://github.com/rife2/bld-checkstyle/actions/workflows/bld.yml)
@@ -21,19 +21,21 @@ public void checkstyle() throws Exception {
}
```
-```
+```console
./bld checkstyle
```
- [View Examples](https://github.com/rife2/bld-checkstyle/blob/master/examples/src/bld/java/com/example/)
-Please check the [CheckstyleOperation documentation](https://rife2.github.io/bld-checkstyle/rife/bld/extension/CheckstyleOperation.html#method-summary) for all available configuration options.
+Please check the [CheckstyleOperation documentation](https://rife2.github.io/bld-checkstyle/rife/bld/extension/CheckstyleOperation.html#method-summary)
+for all available configuration options.
-### Checkstyle Dependency
+## Checkstyle Dependency
-Don't forget to add a Checkstyle `test` dependency to your build file, as it is not provided by the extension. For example:
+Don't forget to add a Checkstyle `test` dependency to your build file, as it is
+not provided by the extension. For example:
```java
repositories = List.of(MAVEN_CENTRAL);
-scope(test).include(dependency("com.puppycrawl.tools", "checkstyle", version(10, 12, 2)));
-
+scope(test).include(dependency("com.puppycrawl.tools", "checkstyle", version(10, 13, 0)));
+```
diff --git a/checkcliargs.sh b/checkcliargs.sh
new file mode 100755
index 0000000..1e271db
--- /dev/null
+++ b/checkcliargs.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+MAIN="com.puppycrawl.tools.checkstyle.Main"
+TMPNEW=/tmp/checkcliargs-new
+TMPOLD=/tmp/checkcliargs-old
+
+java -cp "lib/test/*" $MAIN --help >$TMPNEW
+java -cp "examples/lib/test/*" $MAIN --help >$TMPOLD
+
+diff $TMPOLD $TMPNEW
+
+rm -rf $TMPNEW $TMPOLD
diff --git a/examples/.idea/.name b/examples/.idea/.name
new file mode 100644
index 0000000..4a72ccf
--- /dev/null
+++ b/examples/.idea/.name
@@ -0,0 +1 @@
+bld-checkstyle-examples
\ No newline at end of file
diff --git a/examples/.idea/libraries/bld.xml b/examples/.idea/libraries/bld.xml
index cf75013..0b615c1 100644
--- a/examples/.idea/libraries/bld.xml
+++ b/examples/.idea/libraries/bld.xml
@@ -2,11 +2,12 @@
-
+
-
+
+
@@ -14,4 +15,4 @@
-
\ No newline at end of file
+
diff --git a/examples/.idea/misc.xml b/examples/.idea/misc.xml
index 7e477ca..97c1009 100644
--- a/examples/.idea/misc.xml
+++ b/examples/.idea/misc.xml
@@ -1,4 +1,3 @@
-
@@ -11,4 +10,4 @@
-
+
\ No newline at end of file
diff --git a/examples/.vscode/settings.json b/examples/.vscode/settings.json
index 133aa45..9e8368e 100644
--- a/examples/.vscode/settings.json
+++ b/examples/.vscode/settings.json
@@ -3,13 +3,13 @@
"src/main/java",
"src/main/resources",
"src/test/java",
- "src/bld/java"
+ "src/test/resources",
+ "src/bld/java",
+ "src/bld/resources"
],
"java.configuration.updateBuildConfiguration": "automatic",
"java.project.referencedLibraries": [
- "${HOME}/.bld/dist/bld-1.7.5.jar",
- "lib/compile/*.jar",
- "lib/runtime/*.jar",
- "lib/test/*.jar"
+ "${HOME}/.bld/dist/bld-1.9.0.jar",
+ "lib/**/*.jar"
]
}
diff --git a/examples/README.md b/examples/README.md
new file mode 100644
index 0000000..8fcbd04
--- /dev/null
+++ b/examples/README.md
@@ -0,0 +1,6 @@
+# Compile and Run Checkstyle
+
+```console
+./bld compile checkstyle
+```
+
diff --git a/examples/lib/bld/bld-wrapper.jar b/examples/lib/bld/bld-wrapper.jar
index e9d9403..15c39db 100644
Binary files a/examples/lib/bld/bld-wrapper.jar and b/examples/lib/bld/bld-wrapper.jar differ
diff --git a/examples/lib/bld/bld-wrapper.properties b/examples/lib/bld/bld-wrapper.properties
index 8ac95b9..75eeadf 100644
--- a/examples/lib/bld/bld-wrapper.properties
+++ b/examples/lib/bld/bld-wrapper.properties
@@ -1,7 +1,7 @@
bld.downloadExtensionJavadoc=false
bld.downloadExtensionSources=true
-bld.extensions=com.uwyn.rife2:bld-checkstyle:0.9.0-SNAPSHOT
-bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_RELEASES
+bld.extensions=com.uwyn.rife2:bld-checkstyle:0.9.2
+bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
bld.downloadLocation=
bld.sourceDirectories=
-bld.version=1.7.5
+bld.version=1.9.0
diff --git a/examples/src/bld/java/com/example/ExamplesBuild.java b/examples/src/bld/java/com/example/ExamplesBuild.java
index daf4979..c4bddee 100644
--- a/examples/src/bld/java/com/example/ExamplesBuild.java
+++ b/examples/src/bld/java/com/example/ExamplesBuild.java
@@ -16,10 +16,12 @@ public class ExamplesBuild extends BaseProject {
mainClass = "com.example.ExamplesMain";
version = version(0, 1, 0);
+ autoDownloadPurge = true;
downloadSources = true;
+
repositories = List.of(MAVEN_CENTRAL);
- scope(test).include(dependency("com.puppycrawl.tools", "checkstyle", version(10, 12, 4)));
+ scope(test).include(dependency("com.puppycrawl.tools", "checkstyle", version(10, 13, 0)));
testOperation().mainClass("com.example.ExamplesTest");
}
@@ -36,4 +38,4 @@ public class ExamplesBuild extends BaseProject {
.execute();
}
-}
\ No newline at end of file
+}
diff --git a/lib/bld/bld-wrapper.jar b/lib/bld/bld-wrapper.jar
index e9d9403..15c39db 100644
Binary files a/lib/bld/bld-wrapper.jar and b/lib/bld/bld-wrapper.jar differ
diff --git a/lib/bld/bld-wrapper.properties b/lib/bld/bld-wrapper.properties
index f8b51d9..bce2521 100644
--- a/lib/bld/bld-wrapper.properties
+++ b/lib/bld/bld-wrapper.properties
@@ -1,8 +1,8 @@
bld.downloadExtensionJavadoc=false
bld.downloadExtensionSources=true
-bld.extension-pmd=com.uwyn.rife2:bld-pmd:0.9.2
-bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.0
-bld.repositories=MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
+bld.extension-pmd=com.uwyn.rife2:bld-pmd:0.9.7
+bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.3
+bld.repositories=MAVEN_CENTRAL,MAVEN_LOCAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
bld.downloadLocation=
bld.sourceDirectories=
-bld.version=1.7.5
+bld.version=1.9.0
diff --git a/src/bld/java/rife/bld/extension/CheckstyleOperationBuild.java b/src/bld/java/rife/bld/extension/CheckstyleOperationBuild.java
index 69d586b..c7251e9 100644
--- a/src/bld/java/rife/bld/extension/CheckstyleOperationBuild.java
+++ b/src/bld/java/rife/bld/extension/CheckstyleOperationBuild.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2023 the original author or authors.
+ * Copyright 2023-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,14 +27,15 @@ import java.util.List;
import static rife.bld.dependencies.Repository.MAVEN_CENTRAL;
import static rife.bld.dependencies.Repository.RIFE2_RELEASES;
-import static rife.bld.dependencies.Scope.*;
+import static rife.bld.dependencies.Scope.compile;
+import static rife.bld.dependencies.Scope.test;
import static rife.bld.operations.JavadocOptions.DocLinkOption.NO_MISSING;
public class CheckstyleOperationBuild extends Project {
public CheckstyleOperationBuild() {
pkg = "rife.bld.extension";
name = "CheckstyleOperation";
- version = version(0, 9, 0, "SNAPSHOT");
+ version = version(0, 9, 2);
javaRelease = 17;
downloadSources = true;
@@ -42,15 +43,15 @@ public class CheckstyleOperationBuild extends Project {
repositories = List.of(MAVEN_CENTRAL, RIFE2_RELEASES);
scope(compile)
- .include(dependency("com.uwyn.rife2", "bld", version(1, 7, 5)));
+ .include(dependency("com.uwyn.rife2", "bld", version(1, 9, 0)));
scope(test)
- .include(dependency("com.puppycrawl.tools", "checkstyle", version(10, 12, 4)))
- .include(dependency("org.jsoup", "jsoup", version(1, 16, 2)))
- .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 0)))
- .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 0)))
- .include(dependency("org.assertj", "assertj-core", version(3, 24, 2)));
+ .include(dependency("com.puppycrawl.tools", "checkstyle", version(10, 13, 0)))
+ .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 2)))
+ .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 2)))
+ .include(dependency("org.assertj", "assertj-core", version(3, 25, 3)));
javadocOperation()
.javadocOptions()
+ .author()
.docLint(NO_MISSING)
.link("https://rife2.github.io/bld/")
.link("https://rife2.github.io/rife2/");
@@ -60,15 +61,26 @@ public class CheckstyleOperationBuild extends Project {
.info()
.groupId("com.uwyn.rife2")
.artifactId("bld-checkstyle")
- .description("bld Checkstyle Extensions")
+ .description("bld Checkstyle Extension")
.url("https://github.com/rife2/bld-checkstyle")
- .developer(new PublishDeveloper().id("ethauvin").name("Erik C. Thauvin").email("erik@thauvin.net")
- .url("https://erik.thauvin.net/"))
- .license(new PublishLicense().name("The Apache License, Version 2.0")
- .url("http://www.apache.org/licenses/LICENSE-2.0.txt"))
- .scm(new PublishScm().connection("scm:git:https://github.com/rife2/bld-checkstyle.git")
- .developerConnection("scm:git:git@github.com:rife2/bld-checkstyle.git")
- .url("https://github.com/rife2/bld-checkstyle"))
+ .developer(
+ new PublishDeveloper()
+ .id("ethauvin")
+ .name("Erik C. Thauvin")
+ .email("erik@thauvin.net")
+ .url("https://erik.thauvin.net/")
+ )
+ .license(
+ new PublishLicense()
+ .name("The Apache License, Version 2.0")
+ .url("http://www.apache.org/licenses/LICENSE-2.0.txt")
+ )
+ .scm(
+ new PublishScm()
+ .connection("scm:git:https://github.com/rife2/bld-checkstyle.git")
+ .developerConnection("scm:git:git@github.com:rife2/bld-checkstyle.git")
+ .url("https://github.com/rife2/bld-checkstyle")
+ )
.signKey(property("sign.key"))
.signPassphrase(property("sign.passphrase"));
}
diff --git a/src/main/java/rife/bld/extension/CheckstyleOperation.java b/src/main/java/rife/bld/extension/CheckstyleOperation.java
index 8237736..681e992 100644
--- a/src/main/java/rife/bld/extension/CheckstyleOperation.java
+++ b/src/main/java/rife/bld/extension/CheckstyleOperation.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2023 the original author or authors.
+ * Copyright 2023-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -45,9 +45,14 @@ public class CheckstyleOperation extends AbstractProcessOperation paths) {
for (var p : paths) {
- options.put("-e", p);
+ if (isNotBlank(p)) {
+ options.put("-e", p);
+ }
}
return this;
}
/**
* Directory/file pattern to exclude from CheckStyle. Multiple excludes are allowed.
+ *
+ * @param pattern the pattern
+ * @return the checkstyle operation
*/
public CheckstyleOperation excludedPathPattern(String pattern) {
- options.put("-x", pattern);
+ if (isNotBlank(pattern)) {
+ options.put("-x", pattern);
+ }
return this;
}
@@ -152,6 +178,9 @@ public class CheckstyleOperation extends AbstractProcessOperationonly Javadoc comment content
* without including '/**' and '*/' at the beginning and at the end respectively. The option cannot
* be used other options and requires exactly one file to run on to be specified.
+ *
+ * @param isTree {@code true} or {@code false}
+ * @return the checkstyle operation
*/
public CheckstyleOperation javadocTree(boolean isTree) {
if (isTree) {
@@ -208,51 +255,73 @@ public class CheckstyleOperation extends AbstractProcessOperationATTENTION: generated result will have few queries, joined by pipe(|). Together they will match all AST nodes
* on specified line and column. You need to choose only one and recheck that it works. Usage of all of them is also
* ok, but might result in undesirable matching and suppress other issues.
+ *
+ * @param lineColumn the line column
+ * @return the checkstyle operation
*/
public CheckstyleOperation lineColumn(String lineColumn) {
- options.put("-s", lineColumn);
+ if (isNotBlank(lineColumn)) {
+ options.put("-s", lineColumn);
+ }
return this;
}
/**
* Sets the output file. Defaults to stdout.
+ *
+ * @param file the file
+ * @return the checkstyle operation
*/
public CheckstyleOperation output(String file) {
- options.put("-o", file);
+ if (isNotBlank(file)) {
+ options.put("-o", file);
+ }
return this;
}
/**
* Sets the property files to load.
+ *
+ * @param file the file
+ * @return the checkstyle operation
*/
public CheckstyleOperation propertiesFile(String file) {
- options.put("-p", file);
+ if (isNotBlank(file)) {
+ options.put("-p", file);
+ }
return this;
}
/**
* Specified the file(s) or folder(s) containing the source files to check.
*
+ * @param dir one or more directories
+ * @return the checkstyle operation
* @see #sourceDir(Collection)
*/
public CheckstyleOperation sourceDir(String... dir) {
- sourceDirs.addAll(Arrays.asList(dir));
+ sourceDirs.addAll(Arrays.stream(dir).filter(this::isNotBlank).toList());
return this;
}
/**
* Specified the file(s) or folder(s) containing the source files to check.
*
+ * @param dirs the directories
+ * @return the checkstyle operation
* @see #sourceDir(String...)
*/
public CheckstyleOperation sourceDir(Collection dirs) {
- sourceDirs.addAll(dirs);
+ sourceDirs.addAll(dirs.stream().filter(this::isNotBlank).toList());
return this;
}
/**
* Sets the length of the tab character. Used only with the {@link #lineColumn(String) lineColum} option.
* Default value is {@code 8}.
+ *
+ * @param length the length
+ * @return the checkstyle operation
*/
public CheckstyleOperation tabWith(int length) {
options.put("-w", String.valueOf(length));
@@ -262,6 +331,9 @@ public class CheckstyleOperation extends AbstractProcessOperation