Added support for method parameters as collection

This commit is contained in:
Erik C. Thauvin 2023-11-06 12:48:15 -08:00
parent 66c462a207
commit cfaf68c56b
3 changed files with 51 additions and 23 deletions

View file

@ -27,16 +27,14 @@ 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.compile;
import static rife.bld.dependencies.Scope.runtime;
import static rife.bld.dependencies.Scope.test;
import static rife.bld.dependencies.Scope.*;
import static rife.bld.operations.JavadocOptions.DocLinkOption.NO_MISSING;
public class PmdOperationBuild extends Project {
public PmdOperationBuild() {
pkg = "rife.bld.extension";
name = "bld-pmd";
version = version(0, 9, 4);
version = version(0, 9, 5, "SNAPSHOT");
javaRelease = 17;
downloadSources = true;
@ -49,14 +47,15 @@ public class PmdOperationBuild extends Project {
.include(dependency("net.sourceforge.pmd", "pmd-java", pmd));
scope(runtime)
.include(dependency("net.sourceforge.pmd", "pmd-java", pmd))
.include(dependency("org.slf4j", "slf4j-simple", version(2,0,9)));
.include(dependency("org.slf4j", "slf4j-simple", version(2, 0, 9)));
scope(test)
.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.junit.jupiter", "junit-jupiter", version(5, 10, 1)))
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 1)))
.include(dependency("org.assertj", "assertj-core", version(3, 24, 2)));
javadocOperation()
.javadocOptions()
.author()
.docLint(NO_MISSING)
.link("https://rife2.github.io/bld/")
.link("https://rife2.github.io/rife2/")

View file

@ -120,24 +120,36 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
/**
* Adds paths to source files, or directories containing source files to analyze.
*
* @see #inputPaths(Path...)
*/
public PmdOperation addInputPath(Path... inputPath) {
inputPaths_.addAll(List.of(inputPath));
return this;
}
/**
* Adds paths to source files, or directories containing source files to analyze.
*/
public PmdOperation addInputPath(Collection<Path> inputPath) {
inputPaths_.addAll(inputPath);
return this;
}
/**
* Adds several paths to shorten paths that are output in the report.
*
* @see #addRelativizeRoot(Path...)
*/
public PmdOperation addRelativizeRoot(Path... relativeRoot) {
relativizeRoots_.addAll(List.of(relativeRoot));
return this;
}
/**
* Adds several paths to shorten paths that are output in the report.
*/
public PmdOperation addRelativizeRoot(Collection<Path> relativeRoot) {
relativizeRoots_.addAll(relativeRoot);
return this;
}
/**
* Adds new rule set paths.
* <p>
@ -153,8 +165,6 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
* <li>{@code category/java/performance.xml}</li>
* <li>{@code category/java/security.xml}</li>
* </ul>
*
* @see #ruleSets(String...)
*/
public PmdOperation addRuleSet(String... ruleSet) {
ruleSets_.addAll(List.of(ruleSet));
@ -176,8 +186,6 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
* <li>{@code category/java/performance.xml}</li>
* <li>{@code category/java/security.xml}</li>
* </ul>
*
* @see #ruleSets(Collection)
*/
public PmdOperation addRuleSet(Collection<String> ruleSets) {
ruleSets_.addAll(ruleSets);
@ -200,6 +208,14 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
return this;
}
/**
* Sets the default language to be used for all input files.
*/
public PmdOperation defaultLanguage(Collection<LanguageVersion> languageVersion) {
languageVersions_.addAll(languageVersion);
return this;
}
/**
* <p>Specifies the character set encoding of the source code files. The default is {@code UTF-8}.</p>
*
@ -354,8 +370,6 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
/**
* Sets the to source files, or directories containing source files to analyze.
* Previously set paths will be disregarded.
*
* @see #addInputPath(Path...)
*/
public PmdOperation inputPaths(Path... inputPath) {
inputPaths_.clear();
@ -363,6 +377,16 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
return this;
}
/**
* Sets the to source files, or directories containing source files to analyze.
* Previously set paths will be disregarded.
*/
public PmdOperation inputPaths(Collection<Path> inputPath) {
inputPaths_.clear();
inputPaths_.addAll(inputPath);
return this;
}
/**
* Performs the PMD analysis with the given config.
*/
@ -415,8 +439,6 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
/**
* Sets several paths to shorten paths that are output in the report. Previous relative paths will be disregarded.
*
* @see #addRelativizeRoot(Path...)
*/
public PmdOperation relativizeRoots(Path... relativeRoot) {
relativizeRoots_.clear();
@ -424,6 +446,15 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
return this;
}
/**
* Sets several paths to shorten paths that are output in the report. Previous relative paths will be disregarded.
*/
public PmdOperation relativizeRoots(Collection<Path> relativeRoot) {
relativizeRoots_.clear();
relativizeRoots_.addAll(relativeRoot);
return this;
}
/**
* Sets the output format of the analysis report. The default is {@code text}.
*/
@ -447,8 +478,6 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
* <li>{@code category/java/performance.xml}</li>
* <li>{@code category/java/security.xml}</li>
* </ul>
*
* @see #addRuleSet(String...)
*/
public PmdOperation ruleSets(String... ruleSet) {
ruleSets_.clear();
@ -471,8 +500,6 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
* <li>{@code category/java/performance.xml}</li>
* <li>{@code category/java/security.xml}</li>
* </ul>
*
* @see #addRuleSet(Collection)
*/
public PmdOperation ruleSets(Collection<String> ruleSets) {
ruleSets_.clear();