Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pmd-cataloger/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ group = "sfdx"
version = "1.0"

val distDir = "$buildDir/../../dist"
val pmdVersion = "6.47.0"
val pmdVersion = "6.48.0"
val pmdFile = "pmd-bin-$pmdVersion.zip"
val pmdUrl = "https://github.com/pmd/pmd/releases/download/pmd_releases%2F${pmdVersion}/${pmdFile}"
val skippableJarRegexes = setOf("""^common_[\d\.-]*\.jar""".toRegex(),
Expand Down
2 changes: 1 addition & 1 deletion src/Constants.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os = require('os');
import path = require('path');

export const PMD_VERSION = '6.47.0';
export const PMD_VERSION = '6.48.0';
export const SFGE_VERSION = '1.0.1-pilot';
export const CATALOG_FILE = 'Catalog.json';
export const CUSTOM_PATHS_FILE = 'CustomPaths.json';
Expand Down
4 changes: 2 additions & 2 deletions src/lib/cpd/CpdEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ export class CpdEngine extends AbstractRuleEngine {
if (xmlStart != -1 && xmlEnd != -1) {
const cpdXml = stdout.slice(xmlStart, xmlEnd + cpdEnd.length);
const cpdJson: Element = xml2js(cpdXml, {compact: false, ignoreDeclaration: true}) as Element;

const duplications = cpdJson.elements[0].elements;
// Not all of the elements in this list will be duplication tags. We only want the ones that are.
const duplications = (cpdJson.elements[0].elements || []).filter(element => element.name === "duplication");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a comment on why this is required?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason, v6.48.0 of PMD now adds extra elements to the CPD XML output in addition to the duplication elements. So we needed to filter those out.
I can add a comment in the code as well if you think it's necessary.

if (duplications) {
ruleResults = this.jsonToRuleResults(duplications);
}
Expand Down