Merge branch 'master' into pr-3819
This commit is contained in:
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@@ -23,7 +23,7 @@ jobs:
|
||||
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
||||
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 2
|
||||
- uses: actions/cache@v2
|
||||
|
2
.github/workflows/git-repo-sync.yml
vendored
2
.github/workflows/git-repo-sync.yml
vendored
@@ -15,7 +15,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: false
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 100
|
||||
- name: Setup Environment
|
||||
|
2
.github/workflows/troubleshooting.yml
vendored
2
.github/workflows/troubleshooting.yml
vendored
@@ -12,7 +12,7 @@ jobs:
|
||||
os: [ ubuntu-latest ]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
|
@@ -66,7 +66,7 @@ public class PmdExample {
|
||||
public static void main(String[] args) {
|
||||
PMDConfiguration configuration = new PMDConfiguration();
|
||||
configuration.setInputPaths("/home/workspace/src/main/java/code");
|
||||
configuration.setRuleSets("rulesets/java/quickstart.xml");
|
||||
configuration.addRuleSet("rulesets/java/quickstart.xml");
|
||||
configuration.setReportFormat("xml");
|
||||
configuration.setReportFile("/home/workspace/pmd-report.xml");
|
||||
|
||||
@@ -85,7 +85,7 @@ You can also provide your own custom renderers.
|
||||
```java
|
||||
PMDConfiguration configuration = new PMDConfiguration();
|
||||
configuration.setMinimumPriority(RulePriority.MEDIUM);
|
||||
configuration.setRuleSets("rulesets/java/quickstart.xml");
|
||||
configuration.addRuleSet("rulesets/java/quickstart.xml");
|
||||
```
|
||||
|
||||
2. Then we configure, which paths to analyze:
|
||||
@@ -166,7 +166,6 @@ import java.nio.file.Paths;
|
||||
import net.sourceforge.pmd.PMDConfiguration;
|
||||
import net.sourceforge.pmd.PmdAnalysis;
|
||||
import net.sourceforge.pmd.RulePriority;
|
||||
import net.sourceforge.pmd.RuleSetLoader;
|
||||
import net.sourceforge.pmd.lang.LanguageRegistry;
|
||||
import net.sourceforge.pmd.renderers.Renderer;
|
||||
import net.sourceforge.pmd.renderers.XMLRenderer;
|
||||
@@ -176,7 +175,7 @@ public class PmdExample2 {
|
||||
public static void main(String[] args) throws IOException {
|
||||
PMDConfiguration configuration = new PMDConfiguration();
|
||||
configuration.setMinimumPriority(RulePriority.MEDIUM);
|
||||
configuration.setRuleSets("rulesets/java/quickstart.xml");
|
||||
configuration.addRuleSet("rulesets/java/quickstart.xml");
|
||||
|
||||
configuration.setInputPaths("/home/workspace/src/main/java/code");
|
||||
|
||||
@@ -191,7 +190,7 @@ public class PmdExample2 {
|
||||
|
||||
try (PmdAnalysis pmd = PmdAnalysis.create(configuration)) {
|
||||
// optional: add more rulesets
|
||||
pmd.addRuleSet(RuleSetLoader.fromPmdConfig(configuration).loadFromResource("custom-ruleset.xml"));
|
||||
pmd.addRuleSet(pmd.newRuleSetLoader().loadFromResource("custom-ruleset.xml"));
|
||||
// optional: add more files
|
||||
pmd.files().addFile(Paths.get("src", "main", "more-java", "ExtraSource.java"));
|
||||
// optional: add more renderers
|
||||
|
@@ -58,6 +58,8 @@ The CLI itself remains compatible, if you run PMD via command-line, no action is
|
||||
|
||||
* apex-performance
|
||||
* [#3773](https://github.com/pmd/pmd/pull/3773): \[apex] EagerlyLoadedDescribeSObjectResult false positives with SObjectField.getDescribe()
|
||||
* core
|
||||
* [#3299](https://github.com/pmd/pmd/issues/3299): \[core] Deprecate system properties of PMDCommandLineInterface
|
||||
|
||||
### API Changes
|
||||
|
||||
@@ -76,6 +78,9 @@ The CLI itself remains compatible, if you run PMD via command-line, no action is
|
||||
{% jdoc core::PMDConfiguration#addRuleSet(java.lang.String) %},
|
||||
and {% jdoc core::PMDConfiguration#getRuleSetPaths() %}.
|
||||
* Several members of {% jdoc test::cli.BaseCLITest %} have been deprecated with replacements.
|
||||
* Several members of {% jdoc core::cli.PMDCommandLineInterface %} have been explicitly deprecated.
|
||||
The whole class however was deprecated long ago already with 6.30.0. It is internal API and should
|
||||
not be used.
|
||||
|
||||
#### Experimental APIs
|
||||
|
||||
|
@@ -50,7 +50,7 @@ import net.sourceforge.pmd.util.log.internal.SimpleMessageReporter;
|
||||
* config.setInputPaths("src/main/java");
|
||||
* config.prependClasspath("target/classes");
|
||||
* config.setMinimumPriority(RulePriority.HIGH);
|
||||
* config.setRuleSets("rulesets/java/quickstart.xml");
|
||||
* config.addRuleSet("rulesets/java/quickstart.xml");
|
||||
* config.setReportFormat("xml");
|
||||
* config.setReportFile("target/pmd-report.xml");
|
||||
*
|
||||
@@ -127,8 +127,7 @@ public final class PmdAnalysis implements AutoCloseable {
|
||||
FileCollectionUtil.collectFiles(config, pmd.files());
|
||||
|
||||
if (config.getReportFormat() != null) {
|
||||
Renderer renderer = config.createRenderer();
|
||||
renderer.setReportFile(config.getReportFile());
|
||||
Renderer renderer = config.createRenderer(true);
|
||||
pmd.addRenderer(renderer);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user