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

@ -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();