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

2
.idea/misc.xml generated
View file

@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="EntryPointsManager"> <component name="EntryPointsManager">
<entry_points version="2.0"> <entry_points version="2.0">
@ -17,6 +18,7 @@
<option value="$PROJECT_DIR$/../bld-exec/config/pmd.xml" /> <option value="$PROJECT_DIR$/../bld-exec/config/pmd.xml" />
<option value="$PROJECT_DIR$/../bld-testng/config/pmd.xml" /> <option value="$PROJECT_DIR$/../bld-testng/config/pmd.xml" />
<option value="K:\java\semver\config\pmd.xml" /> <option value="K:\java\semver\config\pmd.xml" />
<option value="$PROJECT_DIR$/../bld-pitest/config/pmd.xml" />
</list> </list>
</option> </option>
<option name="skipTestSources" value="false" /> <option name="skipTestSources" value="false" />

View file

@ -27,16 +27,14 @@ import java.util.List;
import static rife.bld.dependencies.Repository.MAVEN_CENTRAL; import static rife.bld.dependencies.Repository.MAVEN_CENTRAL;
import static rife.bld.dependencies.Repository.RIFE2_RELEASES; import static rife.bld.dependencies.Repository.RIFE2_RELEASES;
import static rife.bld.dependencies.Scope.compile; import static rife.bld.dependencies.Scope.*;
import static rife.bld.dependencies.Scope.runtime;
import static rife.bld.dependencies.Scope.test;
import static rife.bld.operations.JavadocOptions.DocLinkOption.NO_MISSING; import static rife.bld.operations.JavadocOptions.DocLinkOption.NO_MISSING;
public class PmdOperationBuild extends Project { public class PmdOperationBuild extends Project {
public PmdOperationBuild() { public PmdOperationBuild() {
pkg = "rife.bld.extension"; pkg = "rife.bld.extension";
name = "bld-pmd"; name = "bld-pmd";
version = version(0, 9, 4); version = version(0, 9, 5, "SNAPSHOT");
javaRelease = 17; javaRelease = 17;
downloadSources = true; downloadSources = true;
@ -51,12 +49,13 @@ public class PmdOperationBuild extends Project {
.include(dependency("net.sourceforge.pmd", "pmd-java", pmd)) .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) scope(test)
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 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, 0))) .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 1)))
.include(dependency("org.assertj", "assertj-core", version(3, 24, 2))); .include(dependency("org.assertj", "assertj-core", version(3, 24, 2)));
javadocOperation() javadocOperation()
.javadocOptions() .javadocOptions()
.author()
.docLint(NO_MISSING) .docLint(NO_MISSING)
.link("https://rife2.github.io/bld/") .link("https://rife2.github.io/bld/")
.link("https://rife2.github.io/rife2/") .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. * Adds paths to source files, or directories containing source files to analyze.
*
* @see #inputPaths(Path...)
*/ */
public PmdOperation addInputPath(Path... inputPath) { public PmdOperation addInputPath(Path... inputPath) {
inputPaths_.addAll(List.of(inputPath)); inputPaths_.addAll(List.of(inputPath));
return this; 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. * Adds several paths to shorten paths that are output in the report.
*
* @see #addRelativizeRoot(Path...)
*/ */
public PmdOperation addRelativizeRoot(Path... relativeRoot) { public PmdOperation addRelativizeRoot(Path... relativeRoot) {
relativizeRoots_.addAll(List.of(relativeRoot)); relativizeRoots_.addAll(List.of(relativeRoot));
return this; 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. * Adds new rule set paths.
* <p> * <p>
@ -153,8 +165,6 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
* <li>{@code category/java/performance.xml}</li> * <li>{@code category/java/performance.xml}</li>
* <li>{@code category/java/security.xml}</li> * <li>{@code category/java/security.xml}</li>
* </ul> * </ul>
*
* @see #ruleSets(String...)
*/ */
public PmdOperation addRuleSet(String... ruleSet) { public PmdOperation addRuleSet(String... ruleSet) {
ruleSets_.addAll(List.of(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/performance.xml}</li>
* <li>{@code category/java/security.xml}</li> * <li>{@code category/java/security.xml}</li>
* </ul> * </ul>
*
* @see #ruleSets(Collection)
*/ */
public PmdOperation addRuleSet(Collection<String> ruleSets) { public PmdOperation addRuleSet(Collection<String> ruleSets) {
ruleSets_.addAll(ruleSets); ruleSets_.addAll(ruleSets);
@ -200,6 +208,14 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
return this; 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> * <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. * Sets the to source files, or directories containing source files to analyze.
* Previously set paths will be disregarded. * Previously set paths will be disregarded.
*
* @see #addInputPath(Path...)
*/ */
public PmdOperation inputPaths(Path... inputPath) { public PmdOperation inputPaths(Path... inputPath) {
inputPaths_.clear(); inputPaths_.clear();
@ -363,6 +377,16 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
return this; 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. * 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. * 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) { public PmdOperation relativizeRoots(Path... relativeRoot) {
relativizeRoots_.clear(); relativizeRoots_.clear();
@ -424,6 +446,15 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
return this; 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}. * 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/performance.xml}</li>
* <li>{@code category/java/security.xml}</li> * <li>{@code category/java/security.xml}</li>
* </ul> * </ul>
*
* @see #addRuleSet(String...)
*/ */
public PmdOperation ruleSets(String... ruleSet) { public PmdOperation ruleSets(String... ruleSet) {
ruleSets_.clear(); ruleSets_.clear();
@ -471,8 +500,6 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
* <li>{@code category/java/performance.xml}</li> * <li>{@code category/java/performance.xml}</li>
* <li>{@code category/java/security.xml}</li> * <li>{@code category/java/security.xml}</li>
* </ul> * </ul>
*
* @see #addRuleSet(Collection)
*/ */
public PmdOperation ruleSets(Collection<String> ruleSets) { public PmdOperation ruleSets(Collection<String> ruleSets) {
ruleSets_.clear(); ruleSets_.clear();